- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Configs/TI_DSP_BIOS/stl/stl_function.h

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