_function.h

00001 /*
00002  *
00003  * Copyright (c) 1994
00004  * Hewlett-Packard Company
00005  *
00006  * Copyright (c) 1996-1998
00007  * Silicon Graphics Computer Systems, Inc.
00008  *
00009  * Copyright (c) 1997
00010  * Moscow Center for SPARC Technology
00011  *
00012  * Copyright (c) 1999 
00013  * Boris Fomitchev
00014  *
00015  * This material is provided "as is", with absolutely no warranty expressed
00016  * or implied. Any use is at your own risk.
00017  *
00018  * Permission to use or copy this software for any purpose is hereby granted 
00019  * without fee, provided the above notices are retained on all copies.
00020  * Permission to modify the code and to distribute modified code is granted,
00021  * provided the above notices are retained, and a notice that the code was
00022  * modified is included with the above copyright notice.
00023  *
00024  */
00025 
00026 /* NOTE: This is an internal header file, included by other STL headers.
00027  *   You should not attempt to use it directly.
00028  */
00029 
00030 #ifndef _STLP_INTERNAL_FUNCTION_H
00031 #define _STLP_INTERNAL_FUNCTION_H
00032 
00033 #ifndef _STLP_INTERNAL_FUNCTION_BASE_H
00034 #include <stl/_function_base.h>
00035 #endif
00036 
00037 _STLP_BEGIN_NAMESPACE
00038 
00039 # ifndef _STLP_NO_EXTENSIONS
00040 // identity_element (not part of the C++ standard).
00041 template <class _Tp> inline _Tp identity_element(plus<_Tp>) {  return _Tp(0); }
00042 template <class _Tp> inline _Tp identity_element(multiplies<_Tp>) { return _Tp(1); }
00043 # endif
00044 
00045 #  if defined (_STLP_BASE_TYPEDEF_BUG)
00046 // this workaround is needed for SunPro 4.0.1
00047 // suggested by "Martin Abernethy" <gma@paston.co.uk>:
00048 
00049 // We have to introduce the XXary_predicate_aux structures in order to
00050 // access the argument and return types of predicate functions supplied
00051 // as type parameters. SUN C++ 4.0.1 compiler gives errors for template type parameters
00052 // of the form 'name1::name2', where name1 is itself a type parameter.
00053 template <class _Pair>
00054 struct __pair_aux : private _Pair
00055 {
00056         typedef typename _Pair::first_type first_type;
00057         typedef typename _Pair::second_type second_type;
00058 };
00059 
00060 template <class _Operation>
00061 struct __unary_fun_aux : private _Operation
00062 {
00063         typedef typename _Operation::argument_type argument_type;
00064         typedef typename _Operation::result_type result_type;
00065 };
00066 
00067 template <class _Operation>
00068 struct __binary_fun_aux  : private _Operation
00069 {
00070         typedef typename _Operation::first_argument_type first_argument_type;
00071         typedef typename _Operation::second_argument_type second_argument_type;
00072         typedef typename _Operation::result_type result_type;
00073 };
00074 
00075 #  define __UNARY_ARG(__Operation,__type)  __unary_fun_aux<__Operation>::__type
00076 #  define __BINARY_ARG(__Operation,__type)  __binary_fun_aux<__Operation>::__type
00077 #  define __PAIR_ARG(__Pair,__type)  __pair_aux<__Pair>::__type
00078 # else
00079 #  define __UNARY_ARG(__Operation,__type)  __Operation::__type
00080 #  define __BINARY_ARG(__Operation,__type) __Operation::__type
00081 #  define __PAIR_ARG(__Pair,__type) __Pair::__type
00082 # endif
00083 
00084 template <class _Predicate>
00085 class unary_negate : 
00086     public unary_function<typename __UNARY_ARG(_Predicate,argument_type), bool> {
00087 protected:
00088   _Predicate _M_pred;
00089 public:
00090   explicit unary_negate(const _Predicate& __x) : _M_pred(__x) {}
00091   bool operator()(const typename _Predicate::argument_type& __x) const {
00092     return !_M_pred(__x);
00093   }
00094 };
00095 
00096 template <class _Predicate>
00097 inline unary_negate<_Predicate> 
00098 not1(const _Predicate& __pred)
00099 {
00100   return unary_negate<_Predicate>(__pred);
00101 }
00102 
00103 template <class _Predicate> 
00104 class binary_negate 
00105     : public binary_function<typename __BINARY_ARG(_Predicate,first_argument_type),
00106                              typename __BINARY_ARG(_Predicate,second_argument_type), 
00107                              bool> {
00108 protected:
00109   _Predicate _M_pred;
00110 public:
00111   explicit binary_negate(const _Predicate& __x) : _M_pred(__x) {}
00112   bool operator()(const typename _Predicate::first_argument_type& __x, 
00113                   const typename _Predicate::second_argument_type& __y) const
00114   {
00115     return !_M_pred(__x, __y); 
00116   }
00117 };
00118 
00119 template <class _Predicate>
00120 inline binary_negate<_Predicate> 
00121 not2(const _Predicate& __pred)
00122 {
00123   return binary_negate<_Predicate>(__pred);
00124 }
00125 
00126 template <class _Operation> 
00127 class binder1st : 
00128     public unary_function<typename __BINARY_ARG(_Operation,second_argument_type),
00129                           typename __BINARY_ARG(_Operation,result_type) > {
00130 protected:
00131   _Operation _M_op;
00132   typename _Operation::first_argument_type _M_value;
00133 public:
00134   binder1st(const _Operation& __x,
00135             const typename _Operation::first_argument_type& __y)
00136       : _M_op(__x), _M_value(__y) {}
00137   typename _Operation::result_type
00138   operator()(const typename _Operation::second_argument_type& __x) const {
00139     return _M_op(_M_value, __x); 
00140   }
00141 };
00142 
00143 template <class _Operation, class _Tp>
00144 inline binder1st<_Operation> 
00145 bind1st(const _Operation& __fn, const _Tp& __x) 
00146 {
00147   typedef typename _Operation::first_argument_type _Arg1_type;
00148   return binder1st<_Operation>(__fn, _Arg1_type(__x));
00149 }
00150 
00151 template <class _Operation> 
00152 class binder2nd
00153   : public unary_function<typename __BINARY_ARG(_Operation,first_argument_type),
00154                           typename __BINARY_ARG(_Operation,result_type)> {
00155 protected:
00156   _Operation _M_op;
00157   typename _Operation::second_argument_type value;
00158 public:
00159   binder2nd(const _Operation& __x,
00160             const typename _Operation::second_argument_type& __y) 
00161       : _M_op(__x), value(__y) {}
00162   typename _Operation::result_type
00163   operator()(const typename _Operation::first_argument_type& __x) const {
00164     return _M_op(__x, value); 
00165   }
00166 };
00167 
00168 template <class _Operation, class _Tp>
00169 inline binder2nd<_Operation> 
00170 bind2nd(const _Operation& __fn, const _Tp& __x) 
00171 {
00172   typedef typename _Operation::second_argument_type _Arg2_type;
00173   return binder2nd<_Operation>(__fn, _Arg2_type(__x));
00174 }
00175 
00176 # ifndef _STLP_NO_EXTENSIONS
00177 // unary_compose and binary_compose (extensions, not part of the standard).
00178 
00179 template <class _Operation1, class _Operation2>
00180 class unary_compose : 
00181   public unary_function<typename __UNARY_ARG(_Operation2,argument_type),
00182                         typename __UNARY_ARG(_Operation1,result_type)> {
00183 protected:
00184   _Operation1 _M_fn1;
00185   _Operation2 _M_fn2;
00186 public:
00187   unary_compose(const _Operation1& __x, const _Operation2& __y) 
00188     : _M_fn1(__x), _M_fn2(__y) {}
00189   typename _Operation1::result_type
00190   operator()(const typename _Operation2::argument_type& __x) const {
00191     return _M_fn1(_M_fn2(__x));
00192   }
00193 };
00194 
00195 template <class _Operation1, class _Operation2>
00196 inline unary_compose<_Operation1,_Operation2> 
00197 compose1(const _Operation1& __fn1, const _Operation2& __fn2)
00198 {
00199   return unary_compose<_Operation1,_Operation2>(__fn1, __fn2);
00200 }
00201 
00202 template <class _Operation1, class _Operation2, class _Operation3>
00203 class binary_compose : 
00204     public unary_function<typename __UNARY_ARG(_Operation2,argument_type),
00205                           typename __BINARY_ARG(_Operation1,result_type)> {
00206 protected:
00207   _Operation1 _M_fn1;
00208   _Operation2 _M_fn2;
00209   _Operation3 _M_fn3;
00210 public:
00211   binary_compose(const _Operation1& __x, const _Operation2& __y, 
00212                  const _Operation3& __z) 
00213     : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
00214   typename _Operation1::result_type
00215   operator()(const typename _Operation2::argument_type& __x) const {
00216     return _M_fn1(_M_fn2(__x), _M_fn3(__x));
00217   }
00218 };
00219 
00220 template <class _Operation1, class _Operation2, class _Operation3>
00221 inline binary_compose<_Operation1, _Operation2, _Operation3> 
00222 compose2(const _Operation1& __fn1, const _Operation2& __fn2, 
00223          const _Operation3& __fn3)
00224 {
00225   return binary_compose<_Operation1,_Operation2,_Operation3>
00226     (__fn1, __fn2, __fn3);
00227 }
00228 
00229 # endif /* _STLP_NO_EXTENSIONS */
00230 
00231 template <class _Arg, class _Result>
00232 class pointer_to_unary_function : public unary_function<_Arg, _Result> {
00233 protected:
00234   _Result (*_M_ptr)(_Arg);
00235 public:
00236   pointer_to_unary_function() {}
00237   explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {}
00238   _Result operator()(_Arg __x) const { return _M_ptr(__x); }
00239 };
00240 
00241 template <class _Arg, class _Result>
00242 inline pointer_to_unary_function<_Arg, _Result> ptr_fun(_Result (*__x)(_Arg))
00243 {
00244   return pointer_to_unary_function<_Arg, _Result>(__x);
00245 }
00246 
00247 template <class _Arg1, class _Arg2, class _Result>
00248 class pointer_to_binary_function : 
00249   public binary_function<_Arg1,_Arg2,_Result> {
00250 protected:
00251     _Result (*_M_ptr)(_Arg1, _Arg2);
00252 public:
00253     pointer_to_binary_function() {}
00254     explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2)) 
00255       : _M_ptr(__x) {}
00256     _Result operator()(_Arg1 __x, _Arg2 __y) const {
00257       return _M_ptr(__x, __y);
00258     }
00259 };
00260 
00261 template <class _Arg1, class _Arg2, class _Result>
00262 inline pointer_to_binary_function<_Arg1,_Arg2,_Result> 
00263 ptr_fun(_Result (*__x)(_Arg1, _Arg2)) {
00264   return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__x);
00265 }
00266 
00267 # ifndef _STLP_NO_EXTENSIONS
00268 
00269 // identity is an extension: it is not part of the standard.
00270 template <class _Tp> struct identity : public _Identity<_Tp> {};
00271 // select1st and select2nd are extensions: they are not part of the standard.
00272 template <class _Pair> struct select1st : public _Select1st<_Pair> {};
00273 template <class _Pair> struct select2nd : public _Select2nd<_Pair> {};
00274 
00275 template <class _Arg1, class _Arg2> 
00276 struct project1st : public _Project1st<_Arg1, _Arg2> {};
00277 
00278 template <class _Arg1, class _Arg2>
00279 struct project2nd : public _Project2nd<_Arg1, _Arg2> {};
00280 
00281 
00282 // constant_void_fun, constant_unary_fun, and constant_binary_fun are
00283 // extensions: they are not part of the standard.  (The same, of course,
00284 // is true of the helper functions constant0, constant1, and constant2.)
00285 
00286 template <class _Result>
00287 struct _Constant_void_fun {
00288   typedef _Result result_type;
00289   result_type _M_val;
00290 
00291   _Constant_void_fun(const result_type& __v) : _M_val(__v) {}
00292   const result_type& operator()() const { return _M_val; }
00293 };  
00294 
00295 
00296 template <class _Result>
00297 struct constant_void_fun : public _Constant_void_fun<_Result> {
00298   constant_void_fun(const _Result& __v) : _Constant_void_fun<_Result>(__v) {}
00299 };  
00300 
00301 template <class _Result, __DFL_TMPL_PARAM( _Argument , _Result) >
00302 struct constant_unary_fun : public _Constant_unary_fun<_Result, _Argument>
00303 {
00304   constant_unary_fun(const _Result& __v)
00305     : _Constant_unary_fun<_Result, _Argument>(__v) {}
00306 };
00307 
00308 template <class _Result, __DFL_TMPL_PARAM( _Arg1 , _Result), __DFL_TMPL_PARAM( _Arg2 , _Arg1) >
00309 struct constant_binary_fun
00310   : public _Constant_binary_fun<_Result, _Arg1, _Arg2>
00311 {
00312   constant_binary_fun(const _Result& __v)
00313     : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
00314 };
00315 
00316 template <class _Result>
00317 inline constant_void_fun<_Result> constant0(const _Result& __val)
00318 {
00319   return constant_void_fun<_Result>(__val);
00320 }
00321 
00322 template <class _Result>
00323 inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val)
00324 {
00325   return constant_unary_fun<_Result,_Result>(__val);
00326 }
00327 
00328 template <class _Result>
00329 inline constant_binary_fun<_Result,_Result,_Result> 
00330 constant2(const _Result& __val)
00331 {
00332   return constant_binary_fun<_Result,_Result,_Result>(__val);
00333 }
00334 
00335 // subtractive_rng is an extension: it is not part of the standard.
00336 // Note: this code assumes that int is 32 bits.
00337 class subtractive_rng : public unary_function<_STLP_UINT32_T, _STLP_UINT32_T> {
00338 private:
00339   _STLP_UINT32_T _M_table[55];
00340   _STLP_UINT32_T _M_index1;
00341   _STLP_UINT32_T _M_index2;
00342 public:
00343   _STLP_UINT32_T operator()(_STLP_UINT32_T __limit) {
00344     _M_index1 = (_M_index1 + 1) % 55;
00345     _M_index2 = (_M_index2 + 1) % 55;
00346     _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
00347     return _M_table[_M_index1] % __limit;
00348   }
00349 
00350   void _M_initialize(_STLP_UINT32_T __seed)
00351   {
00352     _STLP_UINT32_T __k = 1;
00353     _M_table[54] = __seed;
00354     _STLP_UINT32_T __i;
00355     for (__i = 0; __i < 54; __i++) {
00356         _STLP_UINT32_T __ii = (21 * (__i + 1) % 55) - 1;
00357         _M_table[__ii] = __k;
00358         __k = __seed - __k;
00359         __seed = _M_table[__ii];
00360     }
00361     for (int __loop = 0; __loop < 4; __loop++) {
00362         for (__i = 0; __i < 55; __i++)
00363             _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
00364     }
00365     _M_index1 = 0;
00366     _M_index2 = 31;
00367   }
00368 
00369   subtractive_rng(unsigned int __seed) { _M_initialize(__seed); }
00370   subtractive_rng() { _M_initialize(161803398ul); }
00371 };
00372 
00373 # endif /* _STLP_NO_EXTENSIONS */
00374 
00375 
00376 // Adaptor function objects: pointers to member functions.
00377 
00378 // There are a total of 16 = 2^4 function objects in this family.
00379 //  (1) Member functions taking no arguments vs member functions taking
00380 //       one argument.
00381 //  (2) Call through pointer vs call through reference.
00382 //  (3) Member function with void return type vs member function with
00383 //      non-void return type.
00384 //  (4) Const vs non-const member function.
00385 
00386 // Note that choice (3) is nothing more than a workaround: according
00387 //  to the draft, compilers should handle void and non-void the same way.
00388 //  This feature is not yet widely implemented, though.  You can only use
00389 //  member functions returning void if your compiler supports partial
00390 //  specialization.
00391 
00392 // All of this complexity is in the function objects themselves.  You can
00393 //  ignore it by using the helper function mem_fun and mem_fun_ref,
00394 //  which create whichever type of adaptor is appropriate.
00395 
00396 template <class _Ret, class _Tp>
00397 class mem_fun_t : public unary_function<_Tp*,_Ret> {
00398   typedef _Ret (_Tp::*_fun_type)(void);
00399 public:
00400   explicit mem_fun_t(_fun_type __pf) : _M_f(__pf) {}
00401   _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); }
00402 private:
00403   _fun_type _M_f;
00404 };
00405 
00406 template <class _Ret, class _Tp>
00407 class const_mem_fun_t : public unary_function<const _Tp*,_Ret> {
00408   typedef _Ret (_Tp::*_fun_type)(void) const;
00409 public:
00410   explicit const_mem_fun_t(_fun_type __pf) : _M_f(__pf) {}
00411   _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); }
00412 private:
00413   _fun_type _M_f;
00414 };
00415 
00416 
00417 template <class _Ret, class _Tp>
00418 class mem_fun_ref_t : public unary_function<_Tp,_Ret> {
00419   typedef _Ret (_Tp::*_fun_type)(void);
00420 public:
00421   explicit mem_fun_ref_t(_fun_type __pf) : _M_f(__pf) {}
00422   _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); }
00423 private:
00424   _fun_type _M_f;
00425 };
00426 
00427 template <class _Ret, class _Tp>
00428 class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> {
00429   typedef _Ret (_Tp::*_fun_type)(void) const;
00430 public:
00431   explicit const_mem_fun_ref_t(_fun_type __pf) : _M_f(__pf) {}
00432   _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }
00433 private:
00434   _fun_type _M_f;
00435 };
00436 
00437 template <class _Ret, class _Tp, class _Arg>
00438 class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> {
00439   typedef _Ret (_Tp::*_fun_type)(_Arg);
00440 public:
00441   explicit mem_fun1_t(_fun_type __pf) : _M_f(__pf) {}
00442   _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
00443 private:
00444   _fun_type _M_f;
00445 };
00446 
00447 template <class _Ret, class _Tp, class _Arg>
00448 class const_mem_fun1_t : public binary_function<const _Tp*,_Arg,_Ret> {
00449   typedef _Ret (_Tp::*_fun_type)(_Arg) const;
00450 public:
00451   explicit const_mem_fun1_t(_fun_type __pf) : _M_f(__pf) {}
00452   _Ret operator()(const _Tp* __p, _Arg __x) const
00453     { return (__p->*_M_f)(__x); }
00454 private:
00455   _fun_type _M_f;
00456 };
00457 
00458 template <class _Ret, class _Tp, class _Arg>
00459 class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
00460   typedef _Ret (_Tp::*_fun_type)(_Arg);
00461 public:
00462   explicit mem_fun1_ref_t(_fun_type __pf) : _M_f(__pf) {}
00463   _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
00464 private:
00465   _fun_type _M_f;
00466 };
00467 
00468 template <class _Ret, class _Tp, class _Arg>
00469 class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
00470   typedef _Ret (_Tp::*_fun_type)(_Arg) const;
00471 public:
00472   explicit const_mem_fun1_ref_t(_fun_type __pf) : _M_f(__pf) {}
00473   _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
00474 private:
00475   _fun_type _M_f;
00476 };
00477 
00478 
00479 # ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
00480 
00481 template <class _Tp>
00482 class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> {
00483   typedef void (_Tp::*_fun_type)(void);
00484 public:
00485   explicit mem_fun_t _STLP_PSPEC2(void,_Tp) (_fun_type __pf) : _M_f(__pf) {}
00486   void operator()(_Tp* __p) const { (__p->*_M_f)(); }
00487 private:
00488   _fun_type _M_f;
00489 };
00490 
00491 template <class _Tp>
00492 class const_mem_fun_t<void, _Tp> : public unary_function<const _Tp*,void> {
00493   typedef void (_Tp::*_fun_type)(void) const;
00494 public:
00495   explicit const_mem_fun_t _STLP_PSPEC2(void,_Tp) (_fun_type __pf) : _M_f(__pf) {}
00496   void operator()(const _Tp* __p) const { (__p->*_M_f)(); }
00497 private:
00498   _fun_type _M_f;
00499 };
00500 
00501 template <class _Tp>
00502 class mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
00503   typedef void (_Tp::*_fun_type)(void);
00504 public:
00505   explicit mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (_fun_type __pf) : _M_f(__pf) {}
00506   void operator()(_Tp& __r) const { (__r.*_M_f)(); }
00507 private:
00508   _fun_type _M_f;
00509 };
00510 
00511 template <class _Tp>
00512 class const_mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
00513   typedef void (_Tp::*_fun_type)(void) const;
00514 public:
00515   explicit const_mem_fun_ref_t _STLP_PSPEC2(void,_Tp) (_fun_type __pf) : _M_f(__pf) {}
00516   void operator()(const _Tp& __r) const { (__r.*_M_f)(); }
00517 private:
00518   _fun_type _M_f;
00519 };
00520 
00521 template <class _Tp, class _Arg>
00522 class mem_fun1_t<void, _Tp, _Arg> : public binary_function<_Tp*,_Arg,void> {
00523   typedef void (_Tp::*_fun_type)(_Arg);
00524 public:
00525   explicit mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (_fun_type __pf) : _M_f(__pf) {}
00526   void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
00527 private:
00528   _fun_type _M_f;
00529 };
00530 
00531 template <class _Tp, class _Arg>
00532 class const_mem_fun1_t<void, _Tp, _Arg> 
00533   : public binary_function<const _Tp*,_Arg,void> {
00534   typedef void (_Tp::*_fun_type)(_Arg) const;
00535 public:
00536   explicit const_mem_fun1_t _STLP_PSPEC3(void,_Tp,_Arg) (_fun_type __pf) : _M_f(__pf) {}
00537   void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
00538 private:
00539   _fun_type _M_f;
00540 };
00541 
00542 template <class _Tp, class _Arg>
00543 class mem_fun1_ref_t<void, _Tp, _Arg>
00544   : public binary_function<_Tp,_Arg,void> {
00545   typedef void (_Tp::*_fun_type)(_Arg);
00546 public:
00547   explicit mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (_fun_type __pf) : _M_f(__pf) {}
00548   void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
00549 private:
00550   _fun_type _M_f;
00551 };
00552 
00553 template <class _Tp, class _Arg>
00554 class const_mem_fun1_ref_t<void, _Tp, _Arg>
00555   : public binary_function<_Tp,_Arg,void> {
00556   typedef void (_Tp::*_fun_type)(_Arg) const;
00557 public:
00558   explicit const_mem_fun1_ref_t _STLP_PSPEC3(void,_Tp,_Arg) (_fun_type __pf) : _M_f(__pf) {}
00559   void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
00560 private:
00561   _fun_type _M_f;
00562 };
00563 
00564 #endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
00565 
00566 # if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)
00567 
00568 // Mem_fun adaptor helper functions.  There are only two:
00569 //  mem_fun and mem_fun_ref.  (mem_fun1 and mem_fun1_ref 
00570 //  are provided for backward compatibility, but they are no longer
00571 //  part of the C++ standard.)
00572 
00573 template <class _Ret, class _Tp>
00574 inline mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)()) { return mem_fun_t<_Ret,_Tp>(__f); }
00575 
00576 template <class _Ret, class _Tp>
00577 inline const_mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)() const)  { return const_mem_fun_t<_Ret,_Tp>(__f); }
00578 
00579 template <class _Ret, class _Tp>
00580 inline mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)())  { return mem_fun_ref_t<_Ret,_Tp>(__f); }
00581 
00582 template <class _Ret, class _Tp>
00583 inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const)  { return const_mem_fun_ref_t<_Ret,_Tp>(__f); }
00584 
00585 
00586 template <class _Ret, class _Tp, class _Arg>
00587 inline mem_fun1_t<_Ret,_Tp,_Arg> 
00588 mem_fun(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
00589 
00590 template <class _Ret, class _Tp, class _Arg>
00591 inline const_mem_fun1_t<_Ret,_Tp,_Arg> 
00592 mem_fun(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
00593 
00594 template <class _Ret, class _Tp, class _Arg>
00595 inline mem_fun1_ref_t<_Ret,_Tp,_Arg> 
00596 mem_fun_ref(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
00597 
00598 template <class _Ret, class _Tp, class _Arg>
00599 inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg>
00600 mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
00601 
00602 # if !(defined (_STLP_NO_EXTENSIONS) || defined (_STLP_NO_ANACHRONISMS))
00603 //  mem_fun1 and mem_fun1_ref are no longer part of the C++ standard,
00604 //  but they are provided for backward compatibility.
00605 template <class _Ret, class _Tp, class _Arg>
00606 inline mem_fun1_t<_Ret,_Tp,_Arg> 
00607 mem_fun1(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
00608 
00609 template <class _Ret, class _Tp, class _Arg>
00610 inline const_mem_fun1_t<_Ret,_Tp,_Arg> 
00611 mem_fun1(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
00612 
00613 template <class _Ret, class _Tp, class _Arg>
00614 inline mem_fun1_ref_t<_Ret,_Tp,_Arg> 
00615 mem_fun1_ref(_Ret (_Tp::*__f)(_Arg)) { return mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
00616 
00617 template <class _Ret, class _Tp, class _Arg>
00618 inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg>
00619 mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const) { return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
00620 
00621 # endif /* _STLP_NO_EXTENSIONS */
00622 
00623 # endif /* _STLP_MEMBER_POINTER_PARAM_BUG */
00624 
00625 _STLP_END_NAMESPACE
00626 
00627 #endif /* _STLP_INTERNAL_FUNCTION_H */
00628 
00629 // Local Variables:
00630 // mode:C++
00631 // End:

Generated on Mon Jun 5 10:20:45 2006 for Intelligence.kdevelop by  doxygen 1.4.6