1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/stlport/stl/_function_adaptors.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,802 @@
1.4 +/*
1.5 + *
1.6 + * Copyright (c) 1994
1.7 + * Hewlett-Packard Company
1.8 + *
1.9 + * Copyright (c) 1996-1998
1.10 + * Silicon Graphics Computer Systems, Inc.
1.11 + *
1.12 + * Copyright (c) 1997
1.13 + * Moscow Center for SPARC Technology
1.14 + *
1.15 + * Copyright (c) 1999
1.16 + * Boris Fomitchev
1.17 + *
1.18 + * Copyright (c) 2000
1.19 + * Pavel Kuznetsov
1.20 + *
1.21 + * Copyright (c) 2001
1.22 + * Meridian'93
1.23 + *
1.24 + * This material is provided "as is", with absolutely no warranty expressed
1.25 + * or implied. Any use is at your own risk.
1.26 + *
1.27 + * Permission to use or copy this software for any purpose is hereby granted
1.28 + * without fee, provided the above notices are retained on all copies.
1.29 + * Permission to modify the code and to distribute modified code is granted,
1.30 + * provided the above notices are retained, and a notice that the code was
1.31 + * modified is included with the above copyright notice.
1.32 + *
1.33 + */
1.34 +
1.35 +/* NOTE: This is an internal header file, included by other STL headers.
1.36 + * You should not attempt to use it directly.
1.37 + */
1.38 +
1.39 +// This file has noo macro protection as it is meant to be included several times
1.40 +// from other header.
1.41 +// Adaptor function objects: pointers to member functions.
1.42 +
1.43 +// There are a total of 16 = 2^4 function objects in this family.
1.44 +// (1) Member functions taking no arguments vs member functions taking
1.45 +// one argument.
1.46 +// (2) Call through pointer vs call through reference.
1.47 +// (3) Member function with void return type vs member function with
1.48 +// non-void return type.
1.49 +// (4) Const vs non-const member function.
1.50 +
1.51 +// Note that choice (3) is nothing more than a workaround: according
1.52 +// to the draft, compilers should handle void and non-void the same way.
1.53 +// This feature is not yet widely implemented, though. You can only use
1.54 +// member functions returning void if your compiler supports partial
1.55 +// specialization.
1.56 +
1.57 +// All of this complexity is in the function objects themselves. You can
1.58 +// ignore it by using the helper function mem_fun and mem_fun_ref,
1.59 +// which create whichever type of adaptor is appropriate.
1.60 +
1.61 +_STLP_BEGIN_NAMESPACE
1.62 +
1.63 +//This implementation will only be used if needed, that is to say when there is the return void bug
1.64 +//and when there is no partial template specialization
1.65 +#if defined(_STLP_DONT_RETURN_VOID) && defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined(_STLP_MEMBER_TEMPLATE_CLASSES)
1.66 +
1.67 +template<class _Result, class _Tp>
1.68 +class _Mem_fun0_ptr : public unary_function<_Tp*, _Result> {
1.69 +protected:
1.70 + typedef _Result (_Tp::*__fun_type) ();
1.71 + explicit _Mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
1.72 +
1.73 +public:
1.74 + _Result operator ()(_Tp* __p) const { return (__p->*_M_f)(); }
1.75 +
1.76 +private:
1.77 + __fun_type _M_f;
1.78 +};
1.79 +
1.80 +template<class _Result, class _Tp, class _Arg>
1.81 +class _Mem_fun1_ptr : public binary_function<_Tp*,_Arg,_Result> {
1.82 +protected:
1.83 + typedef _Result (_Tp::*__fun_type) (_Arg);
1.84 + explicit _Mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
1.85 +
1.86 +public:
1.87 + _Result operator ()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
1.88 +
1.89 +private:
1.90 + __fun_type _M_f;
1.91 +};
1.92 +
1.93 +template<class _Result, class _Tp>
1.94 +class _Const_mem_fun0_ptr : public unary_function<const _Tp*,_Result> {
1.95 +protected:
1.96 + typedef _Result (_Tp::*__fun_type) () const;
1.97 + explicit _Const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
1.98 +
1.99 +public:
1.100 + _Result operator ()(const _Tp* __p) const { return (__p->*_M_f)(); }
1.101 +
1.102 +private:
1.103 + __fun_type _M_f;
1.104 +};
1.105 +
1.106 +template<class _Result, class _Tp, class _Arg>
1.107 +class _Const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,_Result> {
1.108 +protected:
1.109 + typedef _Result (_Tp::*__fun_type) (_Arg) const;
1.110 + explicit _Const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
1.111 +
1.112 +public:
1.113 + _Result operator ()(const _Tp* __p, _Arg __x) const {
1.114 + return (__p->*_M_f)(__x); }
1.115 +
1.116 +private:
1.117 + __fun_type _M_f;
1.118 +};
1.119 +
1.120 +template<class _Result, class _Tp>
1.121 +class _Mem_fun0_ref : public unary_function<_Tp&,_Result> {
1.122 +protected:
1.123 + typedef _Result (_Tp::*__fun_type) ();
1.124 + explicit _Mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
1.125 +
1.126 +public:
1.127 + _Result operator ()(_Tp& __p) const { return (__p.*_M_f)(); }
1.128 +
1.129 +private:
1.130 + __fun_type _M_f;
1.131 +};
1.132 +
1.133 +template<class _Result, class _Tp, class _Arg>
1.134 +class _Mem_fun1_ref : public binary_function<_Tp&,_Arg,_Result> {
1.135 +protected:
1.136 + typedef _Result (_Tp::*__fun_type) (_Arg);
1.137 + explicit _Mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
1.138 +
1.139 +public:
1.140 + _Result operator ()(_Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
1.141 +
1.142 +private:
1.143 + __fun_type _M_f;
1.144 +};
1.145 +
1.146 +template<class _Result, class _Tp>
1.147 +class _Const_mem_fun0_ref : public unary_function<const _Tp&,_Result> {
1.148 +protected:
1.149 + typedef _Result (_Tp::*__fun_type) () const;
1.150 + explicit _Const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
1.151 +
1.152 +public:
1.153 + _Result operator ()(const _Tp& __p) const { return (__p.*_M_f)(); }
1.154 +
1.155 +private:
1.156 + __fun_type _M_f;
1.157 +};
1.158 +
1.159 +template<class _Result, class _Tp, class _Arg>
1.160 +class _Const_mem_fun1_ref : public binary_function<const _Tp&,_Arg,_Result> {
1.161 +protected:
1.162 + typedef _Result (_Tp::*__fun_type) (_Arg) const;
1.163 + explicit _Const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
1.164 +
1.165 +public:
1.166 + _Result operator ()(const _Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
1.167 +
1.168 +private:
1.169 + __fun_type _M_f;
1.170 +};
1.171 +
1.172 +template<class _Result>
1.173 +struct _Mem_fun_traits {
1.174 + template<class _Tp>
1.175 + struct _Args0 {
1.176 + typedef _Mem_fun0_ptr<_Result,_Tp> _Ptr;
1.177 + typedef _Const_mem_fun0_ptr<_Result,_Tp> _Ptr_const;
1.178 + typedef _Mem_fun0_ref<_Result,_Tp> _Ref;
1.179 + typedef _Const_mem_fun0_ref<_Result,_Tp> _Ref_const;
1.180 + };
1.181 +
1.182 + template<class _Tp, class _Arg>
1.183 + struct _Args1 {
1.184 + typedef _Mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr;
1.185 + typedef _Const_mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr_const;
1.186 + typedef _Mem_fun1_ref<_Result,_Tp,_Arg> _Ref;
1.187 + typedef _Const_mem_fun1_ref<_Result,_Tp,_Arg> _Ref_const;
1.188 + };
1.189 +};
1.190 +
1.191 +template<class _Arg, class _Result>
1.192 +class _Ptr_fun1_base : public unary_function<_Arg, _Result> {
1.193 +protected:
1.194 + typedef _Result (*__fun_type) (_Arg);
1.195 + explicit _Ptr_fun1_base(__fun_type __f) : _M_f(__f) {}
1.196 +
1.197 +public:
1.198 + _Result operator()(_Arg __x) const { return _M_f(__x); }
1.199 +
1.200 +private:
1.201 + __fun_type _M_f;
1.202 +};
1.203 +
1.204 +template <class _Arg1, class _Arg2, class _Result>
1.205 +class _Ptr_fun2_base : public binary_function<_Arg1,_Arg2,_Result> {
1.206 +protected:
1.207 + typedef _Result (*__fun_type) (_Arg1, _Arg2);
1.208 + explicit _Ptr_fun2_base(__fun_type __f) : _M_f(__f) {}
1.209 +
1.210 +public:
1.211 + _Result operator()(_Arg1 __x, _Arg2 __y) const { return _M_f(__x, __y); }
1.212 +
1.213 +private:
1.214 + __fun_type _M_f;
1.215 +};
1.216 +
1.217 +template<class _Result>
1.218 +struct _Ptr_fun_traits {
1.219 + template<class _Arg> struct _Args1 {
1.220 + typedef _Ptr_fun1_base<_Arg,_Result> _Fun;
1.221 + };
1.222 +
1.223 + template<class _Arg1, class _Arg2> struct _Args2 {
1.224 + typedef _Ptr_fun2_base<_Arg1,_Arg2,_Result> _Fun;
1.225 + };
1.226 +};
1.227 +
1.228 +/*Specialization for void return type
1.229 +*/
1.230 +template<class _Tp>
1.231 +class _Void_mem_fun0_ptr : public unary_function<_Tp*,void> {
1.232 +protected:
1.233 + typedef void (_Tp::*__fun_type) ();
1.234 + explicit _Void_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
1.235 +
1.236 +public:
1.237 + void operator ()(_Tp* __p) const { (__p->*_M_f)(); }
1.238 +
1.239 +private:
1.240 + __fun_type _M_f;
1.241 +};
1.242 +
1.243 +template<class _Tp, class _Arg>
1.244 +class _Void_mem_fun1_ptr : public binary_function<_Tp*,_Arg,void> {
1.245 +protected:
1.246 + typedef void (_Tp::*__fun_type) (_Arg);
1.247 + explicit _Void_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
1.248 +
1.249 +public:
1.250 + void operator ()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
1.251 +
1.252 +private:
1.253 + __fun_type _M_f;
1.254 +};
1.255 +
1.256 +template<class _Tp>
1.257 +class _Void_const_mem_fun0_ptr : public unary_function<const _Tp*,void> {
1.258 +protected:
1.259 + typedef void (_Tp::*__fun_type) () const;
1.260 + explicit _Void_const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
1.261 +
1.262 +public:
1.263 + void operator ()(const _Tp* __p) const { (__p->*_M_f)(); }
1.264 +
1.265 +private:
1.266 + __fun_type _M_f;
1.267 +};
1.268 +
1.269 +template<class _Tp, class _Arg>
1.270 +class _Void_const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,void> {
1.271 +protected:
1.272 + typedef void (_Tp::*__fun_type) (_Arg) const;
1.273 + explicit _Void_const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
1.274 +
1.275 +public:
1.276 + void operator ()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
1.277 +
1.278 +private:
1.279 + __fun_type _M_f;
1.280 +};
1.281 +
1.282 +template<class _Tp>
1.283 +class _Void_mem_fun0_ref : public unary_function<_Tp&,void> {
1.284 +protected:
1.285 + typedef void (_Tp::*__fun_type) ();
1.286 + explicit _Void_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
1.287 +
1.288 +public:
1.289 + void operator ()(_Tp& __p) const { (__p.*_M_f)(); }
1.290 +
1.291 +private:
1.292 + __fun_type _M_f;
1.293 +};
1.294 +
1.295 +template<class _Tp, class _Arg>
1.296 +class _Void_mem_fun1_ref : public binary_function<_Tp&,_Arg,void> {
1.297 +protected:
1.298 + typedef void (_Tp::*__fun_type) (_Arg);
1.299 + explicit _Void_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
1.300 +
1.301 +public:
1.302 + void operator ()(_Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
1.303 +
1.304 +private:
1.305 + __fun_type _M_f;
1.306 +};
1.307 +
1.308 +template<class _Tp>
1.309 +class _Void_const_mem_fun0_ref : public unary_function<const _Tp&,void> {
1.310 +protected:
1.311 + typedef void (_Tp::*__fun_type) () const;
1.312 + explicit _Void_const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
1.313 +
1.314 +public:
1.315 + void operator ()(const _Tp& __p) const { (__p.*_M_f)(); }
1.316 +
1.317 +private:
1.318 + __fun_type _M_f;
1.319 +};
1.320 +
1.321 +template<class _Tp, class _Arg>
1.322 +class _Void_const_mem_fun1_ref : public binary_function<const _Tp&,_Arg,void> {
1.323 +protected:
1.324 + typedef void (_Tp::*__fun_type) (_Arg) const;
1.325 + explicit _Void_const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
1.326 +
1.327 +public:
1.328 + void operator ()(const _Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
1.329 +
1.330 +private:
1.331 + __fun_type _M_f;
1.332 +};
1.333 +
1.334 +_STLP_TEMPLATE_NULL
1.335 +struct _Mem_fun_traits<void> {
1.336 + template<class _Tp> struct _Args0 {
1.337 + typedef _Void_mem_fun0_ptr<_Tp> _Ptr;
1.338 + typedef _Void_const_mem_fun0_ptr<_Tp> _Ptr_const;
1.339 + typedef _Void_mem_fun0_ref<_Tp> _Ref;
1.340 + typedef _Void_const_mem_fun0_ref<_Tp> _Ref_const;
1.341 + };
1.342 +
1.343 + template<class _Tp, class _Arg> struct _Args1 {
1.344 + typedef _Void_mem_fun1_ptr<_Tp,_Arg> _Ptr;
1.345 + typedef _Void_const_mem_fun1_ptr<_Tp,_Arg> _Ptr_const;
1.346 + typedef _Void_mem_fun1_ref<_Tp,_Arg> _Ref;
1.347 + typedef _Void_const_mem_fun1_ref<_Tp,_Arg> _Ref_const;
1.348 + };
1.349 +};
1.350 +
1.351 +template<class _Arg>
1.352 +class _Ptr_void_fun1_base : public unary_function<_Arg, void> {
1.353 +protected:
1.354 + typedef void (*__fun_type) (_Arg);
1.355 + explicit _Ptr_void_fun1_base(__fun_type __f) : _M_f(__f) {}
1.356 +
1.357 +public:
1.358 + void operator()(_Arg __x) const { _M_f(__x); }
1.359 +
1.360 +private:
1.361 + __fun_type _M_f;
1.362 +};
1.363 +
1.364 +template <class _Arg1, class _Arg2>
1.365 +class _Ptr_void_fun2_base : public binary_function<_Arg1,_Arg2,void> {
1.366 +protected:
1.367 + typedef void (*__fun_type) (_Arg1, _Arg2);
1.368 + explicit _Ptr_void_fun2_base(__fun_type __f) : _M_f(__f) {}
1.369 +
1.370 +public:
1.371 + void operator()(_Arg1 __x, _Arg2 __y) const { _M_f(__x, __y); }
1.372 +
1.373 +private:
1.374 + __fun_type _M_f;
1.375 +};
1.376 +
1.377 +_STLP_TEMPLATE_NULL
1.378 +struct _Ptr_fun_traits<void> {
1.379 + template<class _Arg> struct _Args1 {
1.380 + typedef _Ptr_void_fun1_base<_Arg> _Fun;
1.381 + };
1.382 +
1.383 + template<class _Arg1, class _Arg2> struct _Args2 {
1.384 + typedef _Ptr_void_fun2_base<_Arg1,_Arg2> _Fun;
1.385 + };
1.386 +};
1.387 +
1.388 +// pavel: need extra level of inheritance here since MSVC++ does not
1.389 +// accept traits-based fake partial specialization for template
1.390 +// arguments other than first
1.391 +
1.392 +template<class _Result, class _Arg>
1.393 +class _Ptr_fun1 :
1.394 + public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun {
1.395 +protected:
1.396 + typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun _Base;
1.397 + explicit _Ptr_fun1(typename _Base::__fun_type __f) : _Base(__f) {}
1.398 +};
1.399 +
1.400 +template<class _Result, class _Arg1, class _Arg2>
1.401 +class _Ptr_fun2 :
1.402 + public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun {
1.403 +protected:
1.404 + typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun _Base;
1.405 + explicit _Ptr_fun2(typename _Base::__fun_type __f) : _Base(__f) {}
1.406 +};
1.407 +
1.408 +
1.409 +#endif /*_STLP_DONT_RETURN_VOID && _STLP_NO_CLASS_PARTIAL_SPECIALIZATION && _STLP_MEMBER_TEMPLATE_CLASSES*/
1.410 +
1.411 +
1.412 +#if !defined(_STLP_DONT_RETURN_VOID) || !defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) || !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
1.413 +
1.414 +template <class _Ret, class _Tp>
1.415 +class mem_fun_t : public unary_function<_Tp*,_Ret> {
1.416 + typedef _Ret (_Tp::*__fun_type)(void);
1.417 +public:
1.418 + explicit mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
1.419 + _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); }
1.420 +private:
1.421 + __fun_type _M_f;
1.422 +};
1.423 +
1.424 +template <class _Ret, class _Tp>
1.425 +class const_mem_fun_t : public unary_function<const _Tp*,_Ret> {
1.426 + typedef _Ret (_Tp::*__fun_type)(void) const;
1.427 +public:
1.428 + explicit const_mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
1.429 + _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); }
1.430 +private:
1.431 + __fun_type _M_f;
1.432 +};
1.433 +
1.434 +
1.435 +template <class _Ret, class _Tp>
1.436 +class mem_fun_ref_t : public unary_function<_Tp,_Ret> {
1.437 + typedef _Ret (_Tp::*__fun_type)(void);
1.438 +public:
1.439 + explicit mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
1.440 + _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); }
1.441 +private:
1.442 + __fun_type _M_f;
1.443 +};
1.444 +
1.445 +template <class _Ret, class _Tp>
1.446 +class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> {
1.447 + typedef _Ret (_Tp::*__fun_type)(void) const;
1.448 +public:
1.449 + explicit const_mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
1.450 + _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }
1.451 +private:
1.452 + __fun_type _M_f;
1.453 +};
1.454 +
1.455 +template <class _Ret, class _Tp, class _Arg>
1.456 +class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> {
1.457 + typedef _Ret (_Tp::*__fun_type)(_Arg);
1.458 +public:
1.459 + explicit mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
1.460 + _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
1.461 +private:
1.462 + __fun_type _M_f;
1.463 +};
1.464 +
1.465 +template <class _Ret, class _Tp, class _Arg>
1.466 +class const_mem_fun1_t : public binary_function<const _Tp*,_Arg,_Ret> {
1.467 + typedef _Ret (_Tp::*__fun_type)(_Arg) const;
1.468 +public:
1.469 + explicit const_mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
1.470 + _Ret operator()(const _Tp* __p, _Arg __x) const
1.471 + { return (__p->*_M_f)(__x); }
1.472 +private:
1.473 + __fun_type _M_f;
1.474 +};
1.475 +
1.476 +template <class _Ret, class _Tp, class _Arg>
1.477 +class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
1.478 + typedef _Ret (_Tp::*__fun_type)(_Arg);
1.479 +public:
1.480 + explicit mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
1.481 + _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
1.482 +private:
1.483 + __fun_type _M_f;
1.484 +};
1.485 +
1.486 +template <class _Ret, class _Tp, class _Arg>
1.487 +class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
1.488 + typedef _Ret (_Tp::*__fun_type)(_Arg) const;
1.489 +public:
1.490 + explicit const_mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
1.491 + _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
1.492 +private:
1.493 + __fun_type _M_f;
1.494 +};
1.495 +
1.496 +template <class _Arg, class _Result>
1.497 +class pointer_to_unary_function : public unary_function<_Arg, _Result> {
1.498 +protected:
1.499 + _Result (*_M_ptr)(_Arg);
1.500 +public:
1.501 + pointer_to_unary_function() {}
1.502 + explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {}
1.503 + _Result operator()(_Arg __x) const { return _M_ptr(__x); }
1.504 +};
1.505 +
1.506 +template <class _Arg1, class _Arg2, class _Result>
1.507 +class pointer_to_binary_function :
1.508 + public binary_function<_Arg1,_Arg2,_Result> {
1.509 +protected:
1.510 + _Result (*_M_ptr)(_Arg1, _Arg2);
1.511 +public:
1.512 + pointer_to_binary_function() {}
1.513 + explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2))
1.514 + : _M_ptr(__x) {}
1.515 + _Result operator()(_Arg1 __x, _Arg2 __y) const {
1.516 + return _M_ptr(__x, __y);
1.517 + }
1.518 +};
1.519 +
1.520 +
1.521 +#if defined(_STLP_DONT_RETURN_VOID) && !defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION)
1.522 +//Partial specialization for the void type
1.523 +template <class _Tp>
1.524 +class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> {
1.525 + typedef void (_Tp::*__fun_type)(void);
1.526 +public:
1.527 + explicit mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
1.528 + void operator()(_Tp* __p) const { (__p->*_M_f)(); }
1.529 +private:
1.530 + __fun_type _M_f;
1.531 +};
1.532 +
1.533 +template <class _Tp>
1.534 +class const_mem_fun_t<void, _Tp> : public unary_function<const _Tp*,void> {
1.535 + typedef void (_Tp::*__fun_type)(void) const;
1.536 +public:
1.537 + explicit const_mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
1.538 + void operator()(const _Tp* __p) const { (__p->*_M_f)(); }
1.539 +private:
1.540 + __fun_type _M_f;
1.541 +};
1.542 +
1.543 +template <class _Tp>
1.544 +class mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
1.545 + typedef void (_Tp::*__fun_type)(void);
1.546 +public:
1.547 + explicit mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
1.548 + void operator()(_Tp& __r) const { (__r.*_M_f)(); }
1.549 +private:
1.550 + __fun_type _M_f;
1.551 +};
1.552 +
1.553 +template <class _Tp>
1.554 +class const_mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
1.555 + typedef void (_Tp::*__fun_type)(void) const;
1.556 +public:
1.557 + explicit const_mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
1.558 + void operator()(const _Tp& __r) const { (__r.*_M_f)(); }
1.559 +private:
1.560 + __fun_type _M_f;
1.561 +};
1.562 +
1.563 +template <class _Tp, class _Arg>
1.564 +class mem_fun1_t<void, _Tp, _Arg> : public binary_function<_Tp*,_Arg,void> {
1.565 + typedef void (_Tp::*__fun_type)(_Arg);
1.566 +public:
1.567 + explicit mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
1.568 + void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
1.569 +private:
1.570 + __fun_type _M_f;
1.571 +};
1.572 +
1.573 +template <class _Tp, class _Arg>
1.574 +class const_mem_fun1_t<void, _Tp, _Arg>
1.575 + : public binary_function<const _Tp*,_Arg,void> {
1.576 + typedef void (_Tp::*__fun_type)(_Arg) const;
1.577 +public:
1.578 + explicit const_mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
1.579 + void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
1.580 +private:
1.581 + __fun_type _M_f;
1.582 +};
1.583 +
1.584 +template <class _Tp, class _Arg>
1.585 +class mem_fun1_ref_t<void, _Tp, _Arg>
1.586 + : public binary_function<_Tp,_Arg,void> {
1.587 + typedef void (_Tp::*__fun_type)(_Arg);
1.588 +public:
1.589 + explicit mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
1.590 + void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
1.591 +private:
1.592 + __fun_type _M_f;
1.593 +};
1.594 +
1.595 +template <class _Tp, class _Arg>
1.596 +class const_mem_fun1_ref_t<void, _Tp, _Arg>
1.597 + : public binary_function<_Tp,_Arg,void> {
1.598 + typedef void (_Tp::*__fun_type)(_Arg) const;
1.599 +public:
1.600 + explicit const_mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
1.601 + void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
1.602 +private:
1.603 + __fun_type _M_f;
1.604 +};
1.605 +
1.606 +template <class _Arg>
1.607 +class pointer_to_unary_function : public unary_function<_Arg, void> {
1.608 + typedef void (*__fun_type)(_Arg);
1.609 + __fun_type _M_ptr;
1.610 +public:
1.611 + pointer_to_unary_function() {}
1.612 + explicit pointer_to_unary_function(__fun_type __x) : _M_ptr(__x) {}
1.613 + void operator()(_Arg __x) const { _M_ptr(__x); }
1.614 +};
1.615 +
1.616 +template <class _Arg1, class _Arg2>
1.617 +class pointer_to_binary_function : public binary_function<_Arg1,_Arg2,void> {
1.618 + typedef void (*__fun_type)(_Arg1, _Arg2);
1.619 + __fun_type _M_ptr;
1.620 +public:
1.621 + pointer_to_binary_function() {}
1.622 + explicit pointer_to_binary_function(__fun_type __x) : _M_ptr(__x) {}
1.623 + void operator()(_Arg1 __x, _Arg2 __y) const { _M_ptr(__x, __y); }
1.624 +};
1.625 +
1.626 +#endif /*_STLP_DONT_RETURN_VOID && !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION*/
1.627 +
1.628 +#else /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*/
1.629 +
1.630 +//mem_fun_t
1.631 +template <class _Result, class _Tp>
1.632 +class mem_fun_t :
1.633 + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr {
1.634 + typedef typename
1.635 + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr _Base;
1.636 +public:
1.637 + explicit mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
1.638 +};
1.639 +
1.640 +//const_mem_fun_t
1.641 +template <class _Result, class _Tp>
1.642 +class const_mem_fun_t :
1.643 + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const {
1.644 + typedef typename
1.645 + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const _Base;
1.646 +public:
1.647 + explicit const_mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
1.648 +};
1.649 +
1.650 +//mem_fun_ref_t
1.651 +template <class _Result, class _Tp>
1.652 +class mem_fun_ref_t :
1.653 + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref {
1.654 + typedef typename
1.655 + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref _Base;
1.656 +public:
1.657 + explicit mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
1.658 +};
1.659 +
1.660 +//const_mem_fun_ref_t
1.661 +template <class _Result, class _Tp>
1.662 +class const_mem_fun_ref_t :
1.663 + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const {
1.664 + typedef typename
1.665 + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const _Base;
1.666 +public:
1.667 + explicit const_mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
1.668 +};
1.669 +
1.670 +//mem_fun1_t
1.671 +template <class _Result, class _Tp, class _Arg>
1.672 +class mem_fun1_t :
1.673 + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr {
1.674 + typedef typename
1.675 + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr _Base;
1.676 +public:
1.677 + explicit mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
1.678 +};
1.679 +
1.680 +//const_mem_fun1_t
1.681 +template <class _Result, class _Tp, class _Arg>
1.682 +class const_mem_fun1_t :
1.683 + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const {
1.684 + typedef typename
1.685 + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const _Base;
1.686 +public:
1.687 + explicit const_mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
1.688 +};
1.689 +
1.690 +//mem_fun1_ref_t
1.691 +template <class _Result, class _Tp, class _Arg>
1.692 +class mem_fun1_ref_t :
1.693 + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref {
1.694 + typedef typename
1.695 + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref _Base;
1.696 +public:
1.697 + explicit mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
1.698 +};
1.699 +
1.700 +//const_mem_fun1_t
1.701 +template <class _Result, class _Tp, class _Arg>
1.702 +class const_mem_fun1_ref_t :
1.703 + public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const {
1.704 + typedef typename
1.705 + _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const _Base;
1.706 +public:
1.707 + explicit const_mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
1.708 +};
1.709 +
1.710 +
1.711 +template <class _Arg, class _Result>
1.712 +class pointer_to_unary_function :
1.713 +public _Ptr_fun1<_Result,_Arg> {
1.714 + typedef typename
1.715 + _Ptr_fun1<_Result,_Arg>::__fun_type __fun_type;
1.716 +public:
1.717 + explicit pointer_to_unary_function(__fun_type __f)
1.718 + : _Ptr_fun1<_Result,_Arg>(__f) {}
1.719 +};
1.720 +
1.721 +template <class _Arg1, class _Arg2, class _Result>
1.722 +class pointer_to_binary_function :
1.723 +public _Ptr_fun2<_Result,_Arg1,_Arg2> {
1.724 + typedef typename
1.725 + _Ptr_fun2<_Result,_Arg1,_Arg2>::__fun_type __fun_type;
1.726 +public:
1.727 + explicit pointer_to_binary_function(__fun_type __f)
1.728 + : _Ptr_fun2<_Result,_Arg1,_Arg2>(__f) {}
1.729 +};
1.730 +
1.731 +#endif /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*/
1.732 +
1.733 +
1.734 +# if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)
1.735 +// Mem_fun adaptor helper functions. There are only two:
1.736 +// mem_fun and mem_fun_ref. (mem_fun1 and mem_fun1_ref
1.737 +// are provided for backward compatibility, but they are no longer
1.738 +// part of the C++ standard.)
1.739 +
1.740 +template <class _Result, class _Tp>
1.741 +inline mem_fun_t<_Result,_Tp>
1.742 +mem_fun(_Result (_Tp::*__f)()) { return mem_fun_t<_Result,_Tp>(__f); }
1.743 +
1.744 +template <class _Result, class _Tp>
1.745 +inline const_mem_fun_t<_Result,_Tp>
1.746 +mem_fun(_Result (_Tp::*__f)() const) { return const_mem_fun_t<_Result,_Tp>(__f); }
1.747 +
1.748 +template <class _Result, class _Tp>
1.749 +inline mem_fun_ref_t<_Result,_Tp>
1.750 +mem_fun_ref(_Result (_Tp::*__f)()) { return mem_fun_ref_t<_Result,_Tp>(__f); }
1.751 +
1.752 +template <class _Result, class _Tp>
1.753 +inline const_mem_fun_ref_t<_Result,_Tp>
1.754 +mem_fun_ref(_Result (_Tp::*__f)() const) { return const_mem_fun_ref_t<_Result,_Tp>(__f); }
1.755 +
1.756 +template <class _Result, class _Tp, class _Arg>
1.757 +inline mem_fun1_t<_Result,_Tp,_Arg>
1.758 +mem_fun(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
1.759 +
1.760 +template <class _Result, class _Tp, class _Arg>
1.761 +inline const_mem_fun1_t<_Result,_Tp,_Arg>
1.762 +mem_fun(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
1.763 +
1.764 +template <class _Result, class _Tp, class _Arg>
1.765 +inline mem_fun1_ref_t<_Result,_Tp,_Arg>
1.766 +mem_fun_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
1.767 +
1.768 +template <class _Result, class _Tp, class _Arg>
1.769 +inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
1.770 +mem_fun_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
1.771 +
1.772 +# if !(defined (_STLP_NO_EXTENSIONS) || defined (_STLP_NO_ANACHRONISMS))
1.773 +// mem_fun1 and mem_fun1_ref are no longer part of the C++ standard,
1.774 +// but they are provided for backward compatibility.
1.775 +template <class _Result, class _Tp, class _Arg>
1.776 +inline mem_fun1_t<_Result,_Tp,_Arg>
1.777 +mem_fun1(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
1.778 +
1.779 +template <class _Result, class _Tp, class _Arg>
1.780 +inline const_mem_fun1_t<_Result,_Tp,_Arg>
1.781 +mem_fun1(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
1.782 +
1.783 +template <class _Result, class _Tp, class _Arg>
1.784 +inline mem_fun1_ref_t<_Result,_Tp,_Arg>
1.785 +mem_fun1_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
1.786 +
1.787 +template <class _Result, class _Tp, class _Arg>
1.788 +inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
1.789 +mem_fun1_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
1.790 +
1.791 +# endif /* _STLP_NO_EXTENSIONS */
1.792 +
1.793 +# endif /* _STLP_MEMBER_POINTER_PARAM_BUG */
1.794 +
1.795 +template <class _Arg, class _Result>
1.796 +inline pointer_to_unary_function<_Arg, _Result>
1.797 +ptr_fun(_Result (*__f)(_Arg))
1.798 +{ return pointer_to_unary_function<_Arg, _Result>(__f); }
1.799 +
1.800 +template <class _Arg1, class _Arg2, class _Result>
1.801 +inline pointer_to_binary_function<_Arg1,_Arg2,_Result>
1.802 +ptr_fun(_Result (*__f)(_Arg1, _Arg2))
1.803 +{ return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f); }
1.804 +
1.805 +_STLP_END_NAMESPACE