epoc32/include/stdapis/stlportv5/stl/_function_adaptors.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/stdapis/stlport/stl/_function_adaptors.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 /*
     2  *
     3  * Copyright (c) 1994
     4  * Hewlett-Packard Company
     5  *
     6  * Copyright (c) 1996-1998
     7  * Silicon Graphics Computer Systems, Inc.
     8  *
     9  * Copyright (c) 1997
    10  * Moscow Center for SPARC Technology
    11  *
    12  * Copyright (c) 1999 
    13  * Boris Fomitchev
    14  *
    15  * Copyright (c) 2000
    16  * Pavel Kuznetsov
    17  *
    18  * Copyright (c) 2001
    19  * Meridian'93
    20  *
    21  * This material is provided "as is", with absolutely no warranty expressed
    22  * or implied. Any use is at your own risk.
    23  *
    24  * Permission to use or copy this software for any purpose is hereby granted 
    25  * without fee, provided the above notices are retained on all copies.
    26  * Permission to modify the code and to distribute modified code is granted,
    27  * provided the above notices are retained, and a notice that the code was
    28  * modified is included with the above copyright notice.
    29  *
    30  */
    31 
    32 /* NOTE: This is an internal header file, included by other STL headers.
    33  *   You should not attempt to use it directly.
    34  */
    35 
    36 // This file has noo macro protection as it is meant to be included several times
    37 // from other header.
    38 // Adaptor function objects: pointers to member functions.
    39 
    40 // There are a total of 16 = 2^4 function objects in this family.
    41 //  (1) Member functions taking no arguments vs member functions taking
    42 //       one argument.
    43 //  (2) Call through pointer vs call through reference.
    44 //  (3) Member function with void return type vs member function with
    45 //      non-void return type.
    46 //  (4) Const vs non-const member function.
    47 
    48 // Note that choice (3) is nothing more than a workaround: according
    49 //  to the draft, compilers should handle void and non-void the same way.
    50 //  This feature is not yet widely implemented, though.  You can only use
    51 //  member functions returning void if your compiler supports partial
    52 //  specialization.
    53 
    54 // All of this complexity is in the function objects themselves.  You can
    55 //  ignore it by using the helper function mem_fun and mem_fun_ref,
    56 //  which create whichever type of adaptor is appropriate.
    57 
    58 _STLP_BEGIN_NAMESPACE
    59 
    60 //This implementation will only be used if needed, that is to say when there is the return void bug
    61 //and when there is no partial template specialization
    62 #if defined(_STLP_DONT_RETURN_VOID) && defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined(_STLP_MEMBER_TEMPLATE_CLASSES)
    63 
    64 template<class _Result, class _Tp>
    65 class _Mem_fun0_ptr : public unary_function<_Tp*, _Result> {
    66 protected:
    67   typedef _Result (_Tp::*__fun_type) ();
    68   explicit _Mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
    69 
    70 public:
    71   _Result operator ()(_Tp* __p) const { return (__p->*_M_f)(); }
    72 
    73 private:
    74   __fun_type _M_f;
    75 };
    76 
    77 template<class _Result, class _Tp, class _Arg>
    78 class _Mem_fun1_ptr : public binary_function<_Tp*,_Arg,_Result> {
    79 protected:
    80   typedef _Result (_Tp::*__fun_type) (_Arg);
    81   explicit _Mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
    82 
    83 public:
    84   _Result operator ()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
    85 
    86 private:
    87   __fun_type _M_f;
    88 };
    89 
    90 template<class _Result, class _Tp>
    91 class _Const_mem_fun0_ptr : public unary_function<const _Tp*,_Result> {
    92 protected:
    93   typedef _Result (_Tp::*__fun_type) () const;
    94   explicit _Const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
    95 
    96 public:
    97   _Result operator ()(const _Tp* __p) const { return (__p->*_M_f)(); }
    98 
    99 private:
   100   __fun_type _M_f;
   101 };
   102 
   103 template<class _Result, class _Tp, class _Arg>
   104 class _Const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,_Result> {
   105 protected:
   106   typedef _Result (_Tp::*__fun_type) (_Arg) const;
   107   explicit _Const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
   108 
   109 public:
   110   _Result operator ()(const _Tp* __p, _Arg __x) const {
   111     return (__p->*_M_f)(__x); }
   112 
   113 private:
   114   __fun_type _M_f;
   115 };
   116 
   117 template<class _Result, class _Tp>
   118 class _Mem_fun0_ref : public unary_function<_Tp&,_Result> {
   119 protected:
   120   typedef _Result (_Tp::*__fun_type) ();
   121   explicit _Mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
   122 
   123 public:
   124   _Result operator ()(_Tp& __p) const { return (__p.*_M_f)(); }
   125 
   126 private:
   127   __fun_type _M_f;
   128 };
   129 
   130 template<class _Result, class _Tp, class _Arg>
   131 class _Mem_fun1_ref : public binary_function<_Tp&,_Arg,_Result> {
   132 protected:
   133   typedef _Result (_Tp::*__fun_type) (_Arg);
   134   explicit _Mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
   135 
   136 public:
   137   _Result operator ()(_Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
   138 
   139 private:
   140   __fun_type _M_f;
   141 };
   142 
   143 template<class _Result, class _Tp>
   144 class _Const_mem_fun0_ref : public unary_function<const _Tp&,_Result> {
   145 protected:
   146   typedef _Result (_Tp::*__fun_type) () const;
   147   explicit _Const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
   148 
   149 public:
   150   _Result operator ()(const _Tp& __p) const { return (__p.*_M_f)(); }
   151 
   152 private:
   153   __fun_type _M_f;
   154 };
   155 
   156 template<class _Result, class _Tp, class _Arg>
   157 class _Const_mem_fun1_ref : public binary_function<const _Tp&,_Arg,_Result> {
   158 protected:
   159   typedef _Result (_Tp::*__fun_type) (_Arg) const;
   160   explicit _Const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
   161 
   162 public:
   163   _Result operator ()(const _Tp& __p, _Arg __x) const { return (__p.*_M_f)(__x); }
   164 
   165 private:
   166   __fun_type _M_f;
   167 };
   168 
   169 template<class _Result> 
   170 struct _Mem_fun_traits {
   171   template<class _Tp> 
   172   struct _Args0 {
   173     typedef _Mem_fun0_ptr<_Result,_Tp>            _Ptr;
   174     typedef _Const_mem_fun0_ptr<_Result,_Tp>      _Ptr_const;
   175     typedef _Mem_fun0_ref<_Result,_Tp>            _Ref;
   176     typedef _Const_mem_fun0_ref<_Result,_Tp>      _Ref_const;
   177   };
   178 
   179   template<class _Tp, class _Arg>
   180   struct _Args1 {
   181     typedef _Mem_fun1_ptr<_Result,_Tp,_Arg>       _Ptr;
   182     typedef _Const_mem_fun1_ptr<_Result,_Tp,_Arg> _Ptr_const;
   183     typedef _Mem_fun1_ref<_Result,_Tp,_Arg>       _Ref;
   184     typedef _Const_mem_fun1_ref<_Result,_Tp,_Arg> _Ref_const;
   185   };
   186 };
   187 
   188 template<class _Arg, class _Result>
   189 class _Ptr_fun1_base : public unary_function<_Arg, _Result> {
   190 protected:
   191   typedef _Result (*__fun_type) (_Arg);
   192   explicit _Ptr_fun1_base(__fun_type __f) : _M_f(__f) {}
   193 
   194 public:
   195   _Result operator()(_Arg __x) const { return _M_f(__x); }
   196 
   197 private:
   198   __fun_type _M_f;
   199 };
   200 
   201 template <class _Arg1, class _Arg2, class _Result>
   202 class _Ptr_fun2_base : public binary_function<_Arg1,_Arg2,_Result> {
   203 protected:
   204   typedef _Result (*__fun_type) (_Arg1, _Arg2);
   205   explicit _Ptr_fun2_base(__fun_type __f) : _M_f(__f) {}
   206 
   207 public:
   208   _Result operator()(_Arg1 __x, _Arg2 __y) const { return _M_f(__x, __y); }
   209 
   210 private:
   211   __fun_type _M_f;
   212 };
   213 
   214 template<class _Result> 
   215 struct _Ptr_fun_traits {
   216   template<class _Arg> struct _Args1 {
   217     typedef _Ptr_fun1_base<_Arg,_Result> _Fun;
   218   };
   219 
   220   template<class _Arg1, class _Arg2> struct _Args2 {
   221     typedef _Ptr_fun2_base<_Arg1,_Arg2,_Result> _Fun;
   222   };
   223 };
   224 
   225 /*Specialization for void return type
   226 */
   227 template<class _Tp>
   228 class _Void_mem_fun0_ptr : public unary_function<_Tp*,void> {
   229 protected:
   230   typedef void (_Tp::*__fun_type) ();
   231   explicit _Void_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
   232 
   233 public:
   234   void operator ()(_Tp* __p) const { (__p->*_M_f)(); }
   235 
   236 private:
   237   __fun_type _M_f;
   238 };
   239 
   240 template<class _Tp, class _Arg>
   241 class _Void_mem_fun1_ptr : public binary_function<_Tp*,_Arg,void> {
   242 protected:
   243   typedef void (_Tp::*__fun_type) (_Arg);
   244   explicit _Void_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
   245 
   246 public:
   247   void operator ()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
   248 
   249 private:
   250   __fun_type _M_f;
   251 };
   252 
   253 template<class _Tp>
   254 class _Void_const_mem_fun0_ptr : public unary_function<const _Tp*,void> {
   255 protected:
   256   typedef void (_Tp::*__fun_type) () const;
   257   explicit _Void_const_mem_fun0_ptr(__fun_type __f) : _M_f(__f) {}
   258 
   259 public:
   260   void operator ()(const _Tp* __p) const { (__p->*_M_f)(); }
   261 
   262 private:
   263   __fun_type _M_f;
   264 };
   265 
   266 template<class _Tp, class _Arg>
   267 class _Void_const_mem_fun1_ptr : public binary_function<const _Tp*,_Arg,void> {
   268 protected:
   269   typedef void (_Tp::*__fun_type) (_Arg) const;
   270   explicit _Void_const_mem_fun1_ptr(__fun_type __f) : _M_f(__f) {}
   271 
   272 public:
   273   void operator ()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
   274 
   275 private:
   276   __fun_type _M_f;
   277 };
   278 
   279 template<class _Tp>
   280 class _Void_mem_fun0_ref : public unary_function<_Tp&,void> {
   281 protected:
   282   typedef void (_Tp::*__fun_type) ();
   283   explicit _Void_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
   284 
   285 public:
   286   void operator ()(_Tp& __p) const { (__p.*_M_f)(); }
   287 
   288 private:
   289   __fun_type _M_f;
   290 };
   291 
   292 template<class _Tp, class _Arg>
   293 class _Void_mem_fun1_ref : public binary_function<_Tp&,_Arg,void> {
   294 protected:
   295   typedef void (_Tp::*__fun_type) (_Arg);
   296   explicit _Void_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
   297 
   298 public:
   299   void operator ()(_Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
   300 
   301 private:
   302   __fun_type _M_f;
   303 };
   304 
   305 template<class _Tp>
   306 class _Void_const_mem_fun0_ref : public unary_function<const _Tp&,void> {
   307 protected:
   308   typedef void (_Tp::*__fun_type) () const;
   309   explicit _Void_const_mem_fun0_ref(__fun_type __f) : _M_f(__f) {}
   310 
   311 public:
   312   void operator ()(const _Tp& __p) const { (__p.*_M_f)(); }
   313 
   314 private:
   315   __fun_type _M_f;
   316 };
   317 
   318 template<class _Tp, class _Arg>
   319 class _Void_const_mem_fun1_ref : public binary_function<const _Tp&,_Arg,void> {
   320 protected:
   321   typedef void (_Tp::*__fun_type) (_Arg) const;
   322   explicit _Void_const_mem_fun1_ref(__fun_type __f) : _M_f(__f) {}
   323 
   324 public:
   325   void operator ()(const _Tp& __p, _Arg __x) const { (__p.*_M_f)(__x); }
   326 
   327 private:
   328   __fun_type _M_f;
   329 };
   330 
   331 _STLP_TEMPLATE_NULL
   332 struct _Mem_fun_traits<void> {
   333   template<class _Tp> struct _Args0 {
   334     typedef _Void_mem_fun0_ptr<_Tp>             _Ptr;
   335     typedef _Void_const_mem_fun0_ptr<_Tp>       _Ptr_const;
   336     typedef _Void_mem_fun0_ref<_Tp>             _Ref;
   337     typedef _Void_const_mem_fun0_ref<_Tp>       _Ref_const;
   338   };
   339 
   340   template<class _Tp, class _Arg> struct _Args1 {
   341     typedef _Void_mem_fun1_ptr<_Tp,_Arg>        _Ptr;
   342     typedef _Void_const_mem_fun1_ptr<_Tp,_Arg>  _Ptr_const;
   343     typedef _Void_mem_fun1_ref<_Tp,_Arg>        _Ref;
   344     typedef _Void_const_mem_fun1_ref<_Tp,_Arg>  _Ref_const;
   345   };
   346 };
   347 
   348 template<class _Arg>
   349 class _Ptr_void_fun1_base : public unary_function<_Arg, void> {
   350 protected:
   351   typedef void (*__fun_type) (_Arg);
   352   explicit _Ptr_void_fun1_base(__fun_type __f) : _M_f(__f) {}
   353 
   354 public:
   355   void operator()(_Arg __x) const { _M_f(__x); }
   356 
   357 private:
   358   __fun_type _M_f;
   359 };
   360 
   361 template <class _Arg1, class _Arg2>
   362 class _Ptr_void_fun2_base : public binary_function<_Arg1,_Arg2,void> {
   363 protected:
   364   typedef void (*__fun_type) (_Arg1, _Arg2);
   365   explicit _Ptr_void_fun2_base(__fun_type __f) : _M_f(__f) {}
   366 
   367 public:
   368   void operator()(_Arg1 __x, _Arg2 __y) const { _M_f(__x, __y); }
   369 
   370 private:
   371   __fun_type _M_f;
   372 };
   373 
   374 _STLP_TEMPLATE_NULL
   375 struct _Ptr_fun_traits<void> {
   376   template<class _Arg> struct _Args1 {
   377     typedef _Ptr_void_fun1_base<_Arg> _Fun;
   378   };
   379   
   380   template<class _Arg1, class _Arg2> struct _Args2 {
   381     typedef _Ptr_void_fun2_base<_Arg1,_Arg2> _Fun;
   382   };
   383 };
   384 
   385 // pavel: need extra level of inheritance here since MSVC++ does not
   386 // accept traits-based fake partial specialization for template
   387 // arguments other than first
   388 
   389 template<class _Result, class _Arg>
   390 class _Ptr_fun1 : 
   391   public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun {
   392 protected:
   393   typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Arg>::_Fun _Base;
   394   explicit _Ptr_fun1(typename _Base::__fun_type __f) : _Base(__f) {}
   395 };
   396 
   397 template<class _Result, class _Arg1, class _Arg2>
   398 class _Ptr_fun2 : 
   399   public _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun {
   400 protected:
   401   typedef typename _Ptr_fun_traits<_Result>::_STLP_TEMPLATE _Args2<_Arg1,_Arg2>::_Fun _Base;
   402   explicit _Ptr_fun2(typename _Base::__fun_type __f) : _Base(__f) {}
   403 };
   404 
   405 
   406 #endif /*_STLP_DONT_RETURN_VOID && _STLP_NO_CLASS_PARTIAL_SPECIALIZATION && _STLP_MEMBER_TEMPLATE_CLASSES*/
   407 
   408 
   409 #if !defined(_STLP_DONT_RETURN_VOID) || !defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) || !defined (_STLP_MEMBER_TEMPLATE_CLASSES)
   410 
   411 template <class _Ret, class _Tp>
   412 class mem_fun_t : public unary_function<_Tp*,_Ret> {
   413   typedef _Ret (_Tp::*__fun_type)(void);
   414 public:
   415   explicit mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
   416   _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); }
   417 private:
   418   __fun_type _M_f;
   419 };
   420 
   421 template <class _Ret, class _Tp>
   422 class const_mem_fun_t : public unary_function<const _Tp*,_Ret> {
   423   typedef _Ret (_Tp::*__fun_type)(void) const;
   424 public:
   425   explicit const_mem_fun_t(__fun_type __pf) : _M_f(__pf) {}
   426   _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); }
   427 private:
   428   __fun_type _M_f;
   429 };
   430 
   431 
   432 template <class _Ret, class _Tp>
   433 class mem_fun_ref_t : public unary_function<_Tp,_Ret> {
   434   typedef _Ret (_Tp::*__fun_type)(void);
   435 public:
   436   explicit mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
   437   _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); }
   438 private:
   439   __fun_type _M_f;
   440 };
   441 
   442 template <class _Ret, class _Tp>
   443 class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> {
   444   typedef _Ret (_Tp::*__fun_type)(void) const;
   445 public:
   446   explicit const_mem_fun_ref_t(__fun_type __pf) : _M_f(__pf) {}
   447   _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }
   448 private:
   449   __fun_type _M_f;
   450 };
   451 
   452 template <class _Ret, class _Tp, class _Arg>
   453 class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> {
   454   typedef _Ret (_Tp::*__fun_type)(_Arg);
   455 public:
   456   explicit mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
   457   _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
   458 private:
   459   __fun_type _M_f;
   460 };
   461 
   462 template <class _Ret, class _Tp, class _Arg>
   463 class const_mem_fun1_t : public binary_function<const _Tp*,_Arg,_Ret> {
   464   typedef _Ret (_Tp::*__fun_type)(_Arg) const;
   465 public:
   466   explicit const_mem_fun1_t(__fun_type __pf) : _M_f(__pf) {}
   467   _Ret operator()(const _Tp* __p, _Arg __x) const
   468     { return (__p->*_M_f)(__x); }
   469 private:
   470   __fun_type _M_f;
   471 };
   472 
   473 template <class _Ret, class _Tp, class _Arg>
   474 class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
   475   typedef _Ret (_Tp::*__fun_type)(_Arg);
   476 public:
   477   explicit mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
   478   _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
   479 private:
   480   __fun_type _M_f;
   481 };
   482 
   483 template <class _Ret, class _Tp, class _Arg>
   484 class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
   485   typedef _Ret (_Tp::*__fun_type)(_Arg) const;
   486 public:
   487   explicit const_mem_fun1_ref_t(__fun_type __pf) : _M_f(__pf) {}
   488   _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
   489 private:
   490   __fun_type _M_f;
   491 };
   492 
   493 template <class _Arg, class _Result>
   494 class pointer_to_unary_function : public unary_function<_Arg, _Result> {
   495 protected:
   496   _Result (*_M_ptr)(_Arg);
   497 public:
   498   pointer_to_unary_function() {}
   499   explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {}
   500   _Result operator()(_Arg __x) const { return _M_ptr(__x); }
   501 };
   502 
   503 template <class _Arg1, class _Arg2, class _Result>
   504 class pointer_to_binary_function : 
   505   public binary_function<_Arg1,_Arg2,_Result> {
   506 protected:
   507     _Result (*_M_ptr)(_Arg1, _Arg2);
   508 public:
   509     pointer_to_binary_function() {}
   510     explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2)) 
   511       : _M_ptr(__x) {}
   512     _Result operator()(_Arg1 __x, _Arg2 __y) const {
   513       return _M_ptr(__x, __y);
   514     }
   515 };
   516 
   517 
   518 #if defined(_STLP_DONT_RETURN_VOID) && !defined(_STLP_NO_CLASS_PARTIAL_SPECIALIZATION)
   519 //Partial specialization for the void type
   520 template <class _Tp>
   521 class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> {
   522   typedef void (_Tp::*__fun_type)(void);
   523 public:
   524   explicit mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
   525   void operator()(_Tp* __p) const { (__p->*_M_f)(); }
   526 private:
   527   __fun_type _M_f;
   528 };
   529 
   530 template <class _Tp>
   531 class const_mem_fun_t<void, _Tp> : public unary_function<const _Tp*,void> {
   532   typedef void (_Tp::*__fun_type)(void) const;
   533 public:
   534   explicit const_mem_fun_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
   535   void operator()(const _Tp* __p) const { (__p->*_M_f)(); }
   536 private:
   537   __fun_type _M_f;
   538 };
   539 
   540 template <class _Tp>
   541 class mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
   542   typedef void (_Tp::*__fun_type)(void);
   543 public:
   544   explicit mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
   545   void operator()(_Tp& __r) const { (__r.*_M_f)(); }
   546 private:
   547   __fun_type _M_f;
   548 };
   549 
   550 template <class _Tp>
   551 class const_mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
   552   typedef void (_Tp::*__fun_type)(void) const;
   553 public:
   554   explicit const_mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (__fun_type __pf) : _M_f(__pf) {}
   555   void operator()(const _Tp& __r) const { (__r.*_M_f)(); }
   556 private:
   557   __fun_type _M_f;
   558 };
   559 
   560 template <class _Tp, class _Arg>
   561 class mem_fun1_t<void, _Tp, _Arg> : public binary_function<_Tp*,_Arg,void> {
   562   typedef void (_Tp::*__fun_type)(_Arg);
   563 public:
   564   explicit mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
   565   void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
   566 private:
   567   __fun_type _M_f;
   568 };
   569 
   570 template <class _Tp, class _Arg>
   571 class const_mem_fun1_t<void, _Tp, _Arg> 
   572   : public binary_function<const _Tp*,_Arg,void> {
   573   typedef void (_Tp::*__fun_type)(_Arg) const;
   574 public:
   575   explicit const_mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
   576   void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
   577 private:
   578   __fun_type _M_f;
   579 };
   580 
   581 template <class _Tp, class _Arg>
   582 class mem_fun1_ref_t<void, _Tp, _Arg>
   583   : public binary_function<_Tp,_Arg,void> {
   584   typedef void (_Tp::*__fun_type)(_Arg);
   585 public:
   586   explicit mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
   587   void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
   588 private:
   589   __fun_type _M_f;
   590 };
   591 
   592 template <class _Tp, class _Arg>
   593 class const_mem_fun1_ref_t<void, _Tp, _Arg>
   594   : public binary_function<_Tp,_Arg,void> {
   595   typedef void (_Tp::*__fun_type)(_Arg) const;
   596 public:
   597   explicit const_mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (__fun_type __pf) : _M_f(__pf) {}
   598   void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
   599 private:
   600   __fun_type _M_f;
   601 };
   602 
   603 template <class _Arg>
   604 class pointer_to_unary_function : public unary_function<_Arg, void> {
   605   typedef void (*__fun_type)(_Arg);
   606   __fun_type _M_ptr;
   607 public:
   608   pointer_to_unary_function() {}
   609   explicit pointer_to_unary_function(__fun_type __x) : _M_ptr(__x) {}
   610   void operator()(_Arg __x) const { _M_ptr(__x); }
   611 };
   612 
   613 template <class _Arg1, class _Arg2>
   614 class pointer_to_binary_function : public binary_function<_Arg1,_Arg2,void> {
   615   typedef void (*__fun_type)(_Arg1, _Arg2);
   616   __fun_type _M_ptr;
   617 public:
   618   pointer_to_binary_function() {}
   619   explicit pointer_to_binary_function(__fun_type __x) : _M_ptr(__x) {}
   620   void operator()(_Arg1 __x, _Arg2 __y) const { _M_ptr(__x, __y); }
   621 };
   622 
   623 #endif /*_STLP_DONT_RETURN_VOID && !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION*/
   624 
   625 #else /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*/
   626 
   627 //mem_fun_t
   628 template <class _Result, class _Tp>
   629 class mem_fun_t : 
   630   public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr {
   631   typedef typename
   632     _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr _Base;
   633 public:
   634   explicit mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
   635 };
   636 
   637 //const_mem_fun_t
   638 template <class _Result, class _Tp>
   639 class const_mem_fun_t : 
   640   public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const {
   641   typedef typename
   642     _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ptr_const _Base;
   643 public:
   644   explicit const_mem_fun_t(typename _Base::__fun_type __f) : _Base(__f) {}
   645 };
   646 
   647 //mem_fun_ref_t
   648 template <class _Result, class _Tp>
   649 class mem_fun_ref_t :
   650   public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref {
   651   typedef typename
   652     _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref _Base;
   653 public:
   654   explicit mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
   655 };
   656 
   657 //const_mem_fun_ref_t
   658 template <class _Result, class _Tp>
   659 class const_mem_fun_ref_t :
   660   public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const {
   661   typedef typename
   662     _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args0<_Tp>::_Ref_const _Base;
   663 public:
   664   explicit const_mem_fun_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
   665 };
   666 
   667 //mem_fun1_t
   668 template <class _Result, class _Tp, class _Arg>
   669 class mem_fun1_t :
   670   public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr {
   671   typedef typename
   672     _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr _Base;
   673 public:
   674   explicit mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
   675 };
   676 
   677 //const_mem_fun1_t
   678 template <class _Result, class _Tp, class _Arg>
   679 class const_mem_fun1_t :
   680   public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const {
   681   typedef typename
   682     _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ptr_const _Base;
   683 public:
   684   explicit const_mem_fun1_t(typename _Base::__fun_type __f) : _Base(__f) {}
   685 };
   686 
   687 //mem_fun1_ref_t
   688 template <class _Result, class _Tp, class _Arg>
   689 class mem_fun1_ref_t :
   690   public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref {
   691   typedef typename
   692     _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref _Base;
   693 public:
   694   explicit mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
   695 };
   696 
   697 //const_mem_fun1_t
   698 template <class _Result, class _Tp, class _Arg>
   699 class const_mem_fun1_ref_t :
   700   public _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const {
   701   typedef typename
   702     _Mem_fun_traits<_Result>::_STLP_TEMPLATE _Args1<_Tp,_Arg>::_Ref_const _Base;
   703 public:
   704   explicit const_mem_fun1_ref_t(typename _Base::__fun_type __f) : _Base(__f) {}
   705 };
   706 
   707 
   708 template <class _Arg, class _Result>
   709 class pointer_to_unary_function :
   710 public _Ptr_fun1<_Result,_Arg> {
   711   typedef typename 
   712     _Ptr_fun1<_Result,_Arg>::__fun_type __fun_type;
   713 public:
   714   explicit pointer_to_unary_function(__fun_type __f)
   715     : _Ptr_fun1<_Result,_Arg>(__f) {}
   716 };
   717 
   718 template <class _Arg1, class _Arg2, class _Result>
   719 class pointer_to_binary_function :
   720 public _Ptr_fun2<_Result,_Arg1,_Arg2> {
   721   typedef typename
   722     _Ptr_fun2<_Result,_Arg1,_Arg2>::__fun_type __fun_type;
   723 public:
   724   explicit pointer_to_binary_function(__fun_type __f)
   725     : _Ptr_fun2<_Result,_Arg1,_Arg2>(__f) {}
   726 };
   727 
   728 #endif /*!_STLP_DONT_RETURN_VOID || !_STLP_NO_CLASS_PARTIAL_SPECIALIZATION || !_STLP_MEMBER_TEMPLATE_CLASSES*/
   729 
   730 
   731 # if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)
   732 // Mem_fun adaptor helper functions.  There are only two:
   733 //  mem_fun and mem_fun_ref.  (mem_fun1 and mem_fun1_ref 
   734 //  are provided for backward compatibility, but they are no longer
   735 //  part of the C++ standard.)
   736 
   737 template <class _Result, class _Tp>
   738 inline mem_fun_t<_Result,_Tp> 
   739 mem_fun(_Result (_Tp::*__f)()) { return mem_fun_t<_Result,_Tp>(__f); }
   740 
   741 template <class _Result, class _Tp>
   742 inline const_mem_fun_t<_Result,_Tp> 
   743 mem_fun(_Result (_Tp::*__f)() const)  { return const_mem_fun_t<_Result,_Tp>(__f); }
   744 
   745 template <class _Result, class _Tp>
   746 inline mem_fun_ref_t<_Result,_Tp> 
   747 mem_fun_ref(_Result (_Tp::*__f)())  { return mem_fun_ref_t<_Result,_Tp>(__f); }
   748 
   749 template <class _Result, class _Tp>
   750 inline const_mem_fun_ref_t<_Result,_Tp> 
   751 mem_fun_ref(_Result (_Tp::*__f)() const)  { return const_mem_fun_ref_t<_Result,_Tp>(__f); }
   752 
   753 template <class _Result, class _Tp, class _Arg>
   754 inline mem_fun1_t<_Result,_Tp,_Arg> 
   755 mem_fun(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
   756 
   757 template <class _Result, class _Tp, class _Arg>
   758 inline const_mem_fun1_t<_Result,_Tp,_Arg> 
   759 mem_fun(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
   760 
   761 template <class _Result, class _Tp, class _Arg>
   762 inline mem_fun1_ref_t<_Result,_Tp,_Arg> 
   763 mem_fun_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
   764 
   765 template <class _Result, class _Tp, class _Arg>
   766 inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
   767 mem_fun_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
   768 
   769 # if !(defined (_STLP_NO_EXTENSIONS) || defined (_STLP_NO_ANACHRONISMS))
   770 //  mem_fun1 and mem_fun1_ref are no longer part of the C++ standard,
   771 //  but they are provided for backward compatibility.
   772 template <class _Result, class _Tp, class _Arg>
   773 inline mem_fun1_t<_Result,_Tp,_Arg> 
   774 mem_fun1(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Result,_Tp,_Arg>(__f); }
   775 
   776 template <class _Result, class _Tp, class _Arg>
   777 inline const_mem_fun1_t<_Result,_Tp,_Arg> 
   778 mem_fun1(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Result,_Tp,_Arg>(__f); }
   779 
   780 template <class _Result, class _Tp, class _Arg>
   781 inline mem_fun1_ref_t<_Result,_Tp,_Arg> 
   782 mem_fun1_ref(_Result (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
   783 
   784 template <class _Result, class _Tp, class _Arg>
   785 inline const_mem_fun1_ref_t<_Result,_Tp,_Arg>
   786 mem_fun1_ref(_Result (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Result,_Tp,_Arg>(__f); }
   787 
   788 # endif /* _STLP_NO_EXTENSIONS */
   789 
   790 # endif /* _STLP_MEMBER_POINTER_PARAM_BUG */
   791 
   792 template <class _Arg, class _Result>
   793 inline pointer_to_unary_function<_Arg, _Result>
   794 ptr_fun(_Result (*__f)(_Arg)) 
   795 { return pointer_to_unary_function<_Arg, _Result>(__f); }
   796 
   797 template <class _Arg1, class _Arg2, class _Result>
   798 inline pointer_to_binary_function<_Arg1,_Arg2,_Result> 
   799 ptr_fun(_Result (*__f)(_Arg1, _Arg2)) 
   800 { return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f); }
   801 
   802 _STLP_END_NAMESPACE