00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef __SGI_STL_INTERNAL_FUNCTION_H
00032 #define __SGI_STL_INTERNAL_FUNCTION_H
00033
00034 namespace std
00035 {
00036
00037 template <class _Arg, class _Result>
00038 struct unary_function {
00039 typedef _Arg argument_type;
00040 typedef _Result result_type;
00041 };
00042
00043 template <class _Arg1, class _Arg2, class _Result>
00044 struct binary_function {
00045 typedef _Arg1 first_argument_type;
00046 typedef _Arg2 second_argument_type;
00047 typedef _Result result_type;
00048 };
00049
00050 template <class _Tp>
00051 struct plus : public binary_function<_Tp,_Tp,_Tp> {
00052 _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x + __y; }
00053 };
00054
00055 template <class _Tp>
00056 struct minus : public binary_function<_Tp,_Tp,_Tp> {
00057 _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x - __y; }
00058 };
00059
00060 template <class _Tp>
00061 struct multiplies : public binary_function<_Tp,_Tp,_Tp> {
00062 _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x * __y; }
00063 };
00064
00065 template <class _Tp>
00066 struct divides : public binary_function<_Tp,_Tp,_Tp> {
00067 _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x / __y; }
00068 };
00069
00070
00071
00072 template <class _Tp> inline _Tp identity_element(plus<_Tp>) {
00073 return _Tp(0);
00074 }
00075 template <class _Tp> inline _Tp identity_element(multiplies<_Tp>) {
00076 return _Tp(1);
00077 }
00078
00079 template <class _Tp>
00080 struct modulus : public binary_function<_Tp,_Tp,_Tp>
00081 {
00082 _Tp operator()(const _Tp& __x, const _Tp& __y) const { return __x % __y; }
00083 };
00084
00085 template <class _Tp>
00086 struct negate : public unary_function<_Tp,_Tp>
00087 {
00088 _Tp operator()(const _Tp& __x) const { return -__x; }
00089 };
00090
00091 template <class _Tp>
00092 struct equal_to : public binary_function<_Tp,_Tp,bool>
00093 {
00094 bool operator()(const _Tp& __x, const _Tp& __y) const { return __x == __y; }
00095 };
00096
00097 template <class _Tp>
00098 struct not_equal_to : public binary_function<_Tp,_Tp,bool>
00099 {
00100 bool operator()(const _Tp& __x, const _Tp& __y) const { return __x != __y; }
00101 };
00102
00103 template <class _Tp>
00104 struct greater : public binary_function<_Tp,_Tp,bool>
00105 {
00106 bool operator()(const _Tp& __x, const _Tp& __y) const { return __x > __y; }
00107 };
00108
00109 template <class _Tp>
00110 struct less : public binary_function<_Tp,_Tp,bool>
00111 {
00112 bool operator()(const _Tp& __x, const _Tp& __y) const { return __x < __y; }
00113 };
00114
00115 template <class _Tp>
00116 struct greater_equal : public binary_function<_Tp,_Tp,bool>
00117 {
00118 bool operator()(const _Tp& __x, const _Tp& __y) const { return __x >= __y; }
00119 };
00120
00121 template <class _Tp>
00122 struct less_equal : public binary_function<_Tp,_Tp,bool>
00123 {
00124 bool operator()(const _Tp& __x, const _Tp& __y) const { return __x <= __y; }
00125 };
00126
00127 template <class _Tp>
00128 struct logical_and : public binary_function<_Tp,_Tp,bool>
00129 {
00130 bool operator()(const _Tp& __x, const _Tp& __y) const { return __x && __y; }
00131 };
00132
00133 template <class _Tp>
00134 struct logical_or : public binary_function<_Tp,_Tp,bool>
00135 {
00136 bool operator()(const _Tp& __x, const _Tp& __y) const { return __x || __y; }
00137 };
00138
00139 template <class _Tp>
00140 struct logical_not : public unary_function<_Tp,bool>
00141 {
00142 bool operator()(const _Tp& __x) const { return !__x; }
00143 };
00144
00145 template <class _Predicate>
00146 class unary_negate
00147 : public unary_function<typename _Predicate::argument_type, bool> {
00148 protected:
00149 _Predicate _M_pred;
00150 public:
00151 explicit unary_negate(const _Predicate& __x) : _M_pred(__x) {}
00152 bool operator()(const typename _Predicate::argument_type& __x) const {
00153 return !_M_pred(__x);
00154 }
00155 };
00156
00157 template <class _Predicate>
00158 inline unary_negate<_Predicate>
00159 not1(const _Predicate& __pred)
00160 {
00161 return unary_negate<_Predicate>(__pred);
00162 }
00163
00164 template <class _Predicate>
00165 class binary_negate
00166 : public binary_function<typename _Predicate::first_argument_type,
00167 typename _Predicate::second_argument_type,
00168 bool> {
00169 protected:
00170 _Predicate _M_pred;
00171 public:
00172 explicit binary_negate(const _Predicate& __x) : _M_pred(__x) {}
00173 bool operator()(const typename _Predicate::first_argument_type& __x,
00174 const typename _Predicate::second_argument_type& __y) const
00175 {
00176 return !_M_pred(__x, __y);
00177 }
00178 };
00179
00180 template <class _Predicate>
00181 inline binary_negate<_Predicate>
00182 not2(const _Predicate& __pred)
00183 {
00184 return binary_negate<_Predicate>(__pred);
00185 }
00186
00187 template <class _Operation>
00188 class binder1st
00189 : public unary_function<typename _Operation::second_argument_type,
00190 typename _Operation::result_type> {
00191 protected:
00192 _Operation op;
00193 typename _Operation::first_argument_type value;
00194 public:
00195 binder1st(const _Operation& __x,
00196 const typename _Operation::first_argument_type& __y)
00197 : op(__x), value(__y) {}
00198 typename _Operation::result_type
00199 operator()(const typename _Operation::second_argument_type& __x) const {
00200 return op(value, __x);
00201 }
00202 };
00203
00204 template <class _Operation, class _Tp>
00205 inline binder1st<_Operation>
00206 bind1st(const _Operation& __fn, const _Tp& __x)
00207 {
00208 typedef typename _Operation::first_argument_type _Arg1_type;
00209 return binder1st<_Operation>(__fn, _Arg1_type(__x));
00210 }
00211
00212 template <class _Operation>
00213 class binder2nd
00214 : public unary_function<typename _Operation::first_argument_type,
00215 typename _Operation::result_type> {
00216 protected:
00217 _Operation op;
00218 typename _Operation::second_argument_type value;
00219 public:
00220 binder2nd(const _Operation& __x,
00221 const typename _Operation::second_argument_type& __y)
00222 : op(__x), value(__y) {}
00223 typename _Operation::result_type
00224 operator()(const typename _Operation::first_argument_type& __x) const {
00225 return op(__x, value);
00226 }
00227 };
00228
00229 template <class _Operation, class _Tp>
00230 inline binder2nd<_Operation>
00231 bind2nd(const _Operation& __fn, const _Tp& __x)
00232 {
00233 typedef typename _Operation::second_argument_type _Arg2_type;
00234 return binder2nd<_Operation>(__fn, _Arg2_type(__x));
00235 }
00236
00237
00238
00239 template <class _Operation1, class _Operation2>
00240 class unary_compose
00241 : public unary_function<typename _Operation2::argument_type,
00242 typename _Operation1::result_type>
00243 {
00244 protected:
00245 _Operation1 _M_fn1;
00246 _Operation2 _M_fn2;
00247 public:
00248 unary_compose(const _Operation1& __x, const _Operation2& __y)
00249 : _M_fn1(__x), _M_fn2(__y) {}
00250 typename _Operation1::result_type
00251 operator()(const typename _Operation2::argument_type& __x) const {
00252 return _M_fn1(_M_fn2(__x));
00253 }
00254 };
00255
00256 template <class _Operation1, class _Operation2>
00257 inline unary_compose<_Operation1,_Operation2>
00258 compose1(const _Operation1& __fn1, const _Operation2& __fn2)
00259 {
00260 return unary_compose<_Operation1,_Operation2>(__fn1, __fn2);
00261 }
00262
00263 template <class _Operation1, class _Operation2, class _Operation3>
00264 class binary_compose
00265 : public unary_function<typename _Operation2::argument_type,
00266 typename _Operation1::result_type> {
00267 protected:
00268 _Operation1 _M_fn1;
00269 _Operation2 _M_fn2;
00270 _Operation3 _M_fn3;
00271 public:
00272 binary_compose(const _Operation1& __x, const _Operation2& __y,
00273 const _Operation3& __z)
00274 : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
00275 typename _Operation1::result_type
00276 operator()(const typename _Operation2::argument_type& __x) const {
00277 return _M_fn1(_M_fn2(__x), _M_fn3(__x));
00278 }
00279 };
00280
00281 template <class _Operation1, class _Operation2, class _Operation3>
00282 inline binary_compose<_Operation1, _Operation2, _Operation3>
00283 compose2(const _Operation1& __fn1, const _Operation2& __fn2,
00284 const _Operation3& __fn3)
00285 {
00286 return binary_compose<_Operation1,_Operation2,_Operation3>
00287 (__fn1, __fn2, __fn3);
00288 }
00289
00290 template <class _Arg, class _Result>
00291 class pointer_to_unary_function : public unary_function<_Arg, _Result> {
00292 protected:
00293 _Result (*_M_ptr)(_Arg);
00294 public:
00295 pointer_to_unary_function() {}
00296 explicit pointer_to_unary_function(_Result (*__x)(_Arg)) : _M_ptr(__x) {}
00297 _Result operator()(_Arg __x) const { return _M_ptr(__x); }
00298 };
00299
00300 template <class _Arg, class _Result>
00301 inline pointer_to_unary_function<_Arg, _Result> ptr_fun(_Result (*__x)(_Arg))
00302 {
00303 return pointer_to_unary_function<_Arg, _Result>(__x);
00304 }
00305
00306 template <class _Arg1, class _Arg2, class _Result>
00307 class pointer_to_binary_function :
00308 public binary_function<_Arg1,_Arg2,_Result> {
00309 protected:
00310 _Result (*_M_ptr)(_Arg1, _Arg2);
00311 public:
00312 pointer_to_binary_function() {}
00313 explicit pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2))
00314 : _M_ptr(__x) {}
00315 _Result operator()(_Arg1 __x, _Arg2 __y) const {
00316 return _M_ptr(__x, __y);
00317 }
00318 };
00319
00320 template <class _Arg1, class _Arg2, class _Result>
00321 inline pointer_to_binary_function<_Arg1,_Arg2,_Result>
00322 ptr_fun(_Result (*__x)(_Arg1, _Arg2)) {
00323 return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__x);
00324 }
00325
00326
00327 template <class _Tp>
00328 struct _Identity : public unary_function<_Tp,_Tp> {
00329 _Tp& operator()(_Tp& __x) const { return __x; }
00330 const _Tp& operator()(const _Tp& __x) const { return __x; }
00331 };
00332
00333 template <class _Tp> struct identity : public _Identity<_Tp> {};
00334
00335
00336 template <class _Pair>
00337 struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> {
00338 typename _Pair::first_type& operator()(_Pair& __x) const {
00339 return __x.first;
00340 }
00341 const typename _Pair::first_type& operator()(const _Pair& __x) const {
00342 return __x.first;
00343 }
00344 };
00345
00346 template <class _Pair>
00347 struct _Select2nd : public unary_function<_Pair, typename _Pair::second_type>
00348 {
00349 typename _Pair::second_type& operator()(_Pair& __x) const {
00350 return __x.second;
00351 }
00352 const typename _Pair::second_type& operator()(const _Pair& __x) const {
00353 return __x.second;
00354 }
00355 };
00356
00357 template <class _Pair> struct select1st : public _Select1st<_Pair> {};
00358 template <class _Pair> struct select2nd : public _Select2nd<_Pair> {};
00359
00360
00361 template <class _Arg1, class _Arg2>
00362 struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> {
00363 _Arg1 operator()(const _Arg1& __x, const _Arg2&) const { return __x; }
00364 };
00365
00366 template <class _Arg1, class _Arg2>
00367 struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> {
00368 _Arg2 operator()(const _Arg1&, const _Arg2& __y) const { return __y; }
00369 };
00370
00371 template <class _Arg1, class _Arg2>
00372 struct project1st : public _Project1st<_Arg1, _Arg2> {};
00373
00374 template <class _Arg1, class _Arg2>
00375 struct project2nd : public _Project2nd<_Arg1, _Arg2> {};
00376
00377
00378
00379
00380
00381 template <class _Result>
00382 struct _Constant_void_fun {
00383 typedef _Result result_type;
00384 result_type _M_val;
00385
00386 _Constant_void_fun(const result_type& __v) : _M_val(__v) {}
00387 const result_type& operator()() const { return _M_val; }
00388 };
00389
00390 template <class _Result, class _Argument>
00391 struct _Constant_unary_fun {
00392 typedef _Argument argument_type;
00393 typedef _Result result_type;
00394 result_type _M_val;
00395
00396 _Constant_unary_fun(const result_type& __v) : _M_val(__v) {}
00397 const result_type& operator()(const _Argument&) const { return _M_val; }
00398 };
00399
00400 template <class _Result, class _Arg1, class _Arg2>
00401 struct _Constant_binary_fun {
00402 typedef _Arg1 first_argument_type;
00403 typedef _Arg2 second_argument_type;
00404 typedef _Result result_type;
00405 _Result _M_val;
00406
00407 _Constant_binary_fun(const _Result& __v) : _M_val(__v) {}
00408 const result_type& operator()(const _Arg1&, const _Arg2&) const {
00409 return _M_val;
00410 }
00411 };
00412
00413 template <class _Result>
00414 struct constant_void_fun : public _Constant_void_fun<_Result> {
00415 constant_void_fun(const _Result& __v) : _Constant_void_fun<_Result>(__v) {}
00416 };
00417
00418
00419 template <class _Result,
00420 class _Argument = _Result>
00421 struct constant_unary_fun : public _Constant_unary_fun<_Result, _Argument>
00422 {
00423 constant_unary_fun(const _Result& __v)
00424 : _Constant_unary_fun<_Result, _Argument>(__v) {}
00425 };
00426
00427
00428 template <class _Result,
00429 class _Arg1 = _Result,
00430 class _Arg2 = _Arg1>
00431 struct constant_binary_fun
00432 : public _Constant_binary_fun<_Result, _Arg1, _Arg2>
00433 {
00434 constant_binary_fun(const _Result& __v)
00435 : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}
00436 };
00437
00438 template <class _Result>
00439 inline constant_void_fun<_Result> constant0(const _Result& __val)
00440 {
00441 return constant_void_fun<_Result>(__val);
00442 }
00443
00444 template <class _Result>
00445 inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val)
00446 {
00447 return constant_unary_fun<_Result,_Result>(__val);
00448 }
00449
00450 template <class _Result>
00451 inline constant_binary_fun<_Result,_Result,_Result>
00452 constant2(const _Result& __val)
00453 {
00454 return constant_binary_fun<_Result,_Result,_Result>(__val);
00455 }
00456
00457
00458
00459 class subtractive_rng : public unary_function<unsigned int, unsigned int> {
00460 private:
00461 unsigned int _M_table[55];
00462 size_t _M_index1;
00463 size_t _M_index2;
00464 public:
00465 unsigned int operator()(unsigned int __limit) {
00466 _M_index1 = (_M_index1 + 1) % 55;
00467 _M_index2 = (_M_index2 + 1) % 55;
00468 _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];
00469 return _M_table[_M_index1] % __limit;
00470 }
00471
00472 void _M_initialize(unsigned int __seed)
00473 {
00474 unsigned int __k = 1;
00475 _M_table[54] = __seed;
00476 size_t __i;
00477 for (__i = 0; __i < 54; __i++) {
00478 size_t __ii = (21 * (__i + 1) % 55) - 1;
00479 _M_table[__ii] = __k;
00480 __k = __seed - __k;
00481 __seed = _M_table[__ii];
00482 }
00483 for (int __loop = 0; __loop < 4; __loop++) {
00484 for (__i = 0; __i < 55; __i++)
00485 _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];
00486 }
00487 _M_index1 = 0;
00488 _M_index2 = 31;
00489 }
00490
00491 subtractive_rng(unsigned int __seed) { _M_initialize(__seed); }
00492 subtractive_rng() { _M_initialize(161803398u); }
00493 };
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519 template <class _Ret, class _Tp>
00520 class mem_fun_t : public unary_function<_Tp*,_Ret> {
00521 public:
00522 explicit mem_fun_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) {}
00523 _Ret operator()(_Tp* __p) const { return (__p->*_M_f)(); }
00524 private:
00525 _Ret (_Tp::*_M_f)();
00526 };
00527
00528 template <class _Ret, class _Tp>
00529 class const_mem_fun_t : public unary_function<const _Tp*,_Ret> {
00530 public:
00531 explicit const_mem_fun_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) {}
00532 _Ret operator()(const _Tp* __p) const { return (__p->*_M_f)(); }
00533 private:
00534 _Ret (_Tp::*_M_f)() const;
00535 };
00536
00537
00538 template <class _Ret, class _Tp>
00539 class mem_fun_ref_t : public unary_function<_Tp,_Ret> {
00540 public:
00541 explicit mem_fun_ref_t(_Ret (_Tp::*__pf)()) : _M_f(__pf) {}
00542 _Ret operator()(_Tp& __r) const { return (__r.*_M_f)(); }
00543 private:
00544 _Ret (_Tp::*_M_f)();
00545 };
00546
00547 template <class _Ret, class _Tp>
00548 class const_mem_fun_ref_t : public unary_function<_Tp,_Ret> {
00549 public:
00550 explicit const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) {}
00551 _Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }
00552 private:
00553 _Ret (_Tp::*_M_f)() const;
00554 };
00555
00556 template <class _Ret, class _Tp, class _Arg>
00557 class mem_fun1_t : public binary_function<_Tp*,_Arg,_Ret> {
00558 public:
00559 explicit mem_fun1_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) {}
00560 _Ret operator()(_Tp* __p, _Arg __x) const { return (__p->*_M_f)(__x); }
00561 private:
00562 _Ret (_Tp::*_M_f)(_Arg);
00563 };
00564
00565 template <class _Ret, class _Tp, class _Arg>
00566 class const_mem_fun1_t : public binary_function<const _Tp*,_Arg,_Ret> {
00567 public:
00568 explicit const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {}
00569 _Ret operator()(const _Tp* __p, _Arg __x) const
00570 { return (__p->*_M_f)(__x); }
00571 private:
00572 _Ret (_Tp::*_M_f)(_Arg) const;
00573 };
00574
00575 template <class _Ret, class _Tp, class _Arg>
00576 class mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
00577 public:
00578 explicit mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg)) : _M_f(__pf) {}
00579 _Ret operator()(_Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
00580 private:
00581 _Ret (_Tp::*_M_f)(_Arg);
00582 };
00583
00584 template <class _Ret, class _Tp, class _Arg>
00585 class const_mem_fun1_ref_t : public binary_function<_Tp,_Arg,_Ret> {
00586 public:
00587 explicit const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {}
00588 _Ret operator()(const _Tp& __r, _Arg __x) const { return (__r.*_M_f)(__x); }
00589 private:
00590 _Ret (_Tp::*_M_f)(_Arg) const;
00591 };
00592
00593 template <class _Tp>
00594 class mem_fun_t<void, _Tp> : public unary_function<_Tp*,void> {
00595 public:
00596 explicit mem_fun_t(void (_Tp::*__pf)()) : _M_f(__pf) {}
00597 void operator()(_Tp* __p) const { (__p->*_M_f)(); }
00598 private:
00599 void (_Tp::*_M_f)();
00600 };
00601
00602 template <class _Tp>
00603 class const_mem_fun_t<void, _Tp> : public unary_function<const _Tp*,void> {
00604 public:
00605 explicit const_mem_fun_t(void (_Tp::*__pf)() const) : _M_f(__pf) {}
00606 void operator()(const _Tp* __p) const { (__p->*_M_f)(); }
00607 private:
00608 void (_Tp::*_M_f)() const;
00609 };
00610
00611 template <class _Tp>
00612 class mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
00613 public:
00614 explicit mem_fun_ref_t(void (_Tp::*__pf)()) : _M_f(__pf) {}
00615 void operator()(_Tp& __r) const { (__r.*_M_f)(); }
00616 private:
00617 void (_Tp::*_M_f)();
00618 };
00619
00620 template <class _Tp>
00621 class const_mem_fun_ref_t<void, _Tp> : public unary_function<_Tp,void> {
00622 public:
00623 explicit const_mem_fun_ref_t(void (_Tp::*__pf)() const) : _M_f(__pf) {}
00624 void operator()(const _Tp& __r) const { (__r.*_M_f)(); }
00625 private:
00626 void (_Tp::*_M_f)() const;
00627 };
00628
00629 template <class _Tp, class _Arg>
00630 class mem_fun1_t<void, _Tp, _Arg> : public binary_function<_Tp*,_Arg,void> {
00631 public:
00632 explicit mem_fun1_t(void (_Tp::*__pf)(_Arg)) : _M_f(__pf) {}
00633 void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
00634 private:
00635 void (_Tp::*_M_f)(_Arg);
00636 };
00637
00638 template <class _Tp, class _Arg>
00639 class const_mem_fun1_t<void, _Tp, _Arg>
00640 : public binary_function<const _Tp*,_Arg,void> {
00641 public:
00642 explicit const_mem_fun1_t(void (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {}
00643 void operator()(const _Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
00644 private:
00645 void (_Tp::*_M_f)(_Arg) const;
00646 };
00647
00648 template <class _Tp, class _Arg>
00649 class mem_fun1_ref_t<void, _Tp, _Arg>
00650 : public binary_function<_Tp,_Arg,void> {
00651 public:
00652 explicit mem_fun1_ref_t(void (_Tp::*__pf)(_Arg)) : _M_f(__pf) {}
00653 void operator()(_Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
00654 private:
00655 void (_Tp::*_M_f)(_Arg);
00656 };
00657
00658 template <class _Tp, class _Arg>
00659 class const_mem_fun1_ref_t<void, _Tp, _Arg>
00660 : public binary_function<_Tp,_Arg,void> {
00661 public:
00662 explicit const_mem_fun1_ref_t(void (_Tp::*__pf)(_Arg) const) : _M_f(__pf) {}
00663 void operator()(const _Tp& __r, _Arg __x) const { (__r.*_M_f)(__x); }
00664 private:
00665 void (_Tp::*_M_f)(_Arg) const;
00666 };
00667
00668
00669
00670
00671
00672
00673
00674 template <class _Ret, class _Tp>
00675 inline mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)())
00676 { return mem_fun_t<_Ret,_Tp>(__f); }
00677
00678 template <class _Ret, class _Tp>
00679 inline const_mem_fun_t<_Ret,_Tp> mem_fun(_Ret (_Tp::*__f)() const)
00680 { return const_mem_fun_t<_Ret,_Tp>(__f); }
00681
00682 template <class _Ret, class _Tp>
00683 inline mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)())
00684 { return mem_fun_ref_t<_Ret,_Tp>(__f); }
00685
00686 template <class _Ret, class _Tp>
00687 inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const)
00688 { return const_mem_fun_ref_t<_Ret,_Tp>(__f); }
00689
00690 template <class _Ret, class _Tp, class _Arg>
00691 inline mem_fun1_t<_Ret,_Tp,_Arg> mem_fun(_Ret (_Tp::*__f)(_Arg))
00692 { return mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
00693
00694 template <class _Ret, class _Tp, class _Arg>
00695 inline const_mem_fun1_t<_Ret,_Tp,_Arg> mem_fun(_Ret (_Tp::*__f)(_Arg) const)
00696 { return const_mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
00697
00698 template <class _Ret, class _Tp, class _Arg>
00699 inline mem_fun1_ref_t<_Ret,_Tp,_Arg> mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
00700 { return mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
00701
00702 template <class _Ret, class _Tp, class _Arg>
00703 inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg>
00704 mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)
00705 { return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
00706
00707 template <class _Ret, class _Tp, class _Arg>
00708 inline mem_fun1_t<_Ret,_Tp,_Arg> mem_fun1(_Ret (_Tp::*__f)(_Arg))
00709 { return mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
00710
00711 template <class _Ret, class _Tp, class _Arg>
00712 inline const_mem_fun1_t<_Ret,_Tp,_Arg> mem_fun1(_Ret (_Tp::*__f)(_Arg) const)
00713 { return const_mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
00714
00715 template <class _Ret, class _Tp, class _Arg>
00716 inline mem_fun1_ref_t<_Ret,_Tp,_Arg> mem_fun1_ref(_Ret (_Tp::*__f)(_Arg))
00717 { return mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
00718
00719 template <class _Ret, class _Tp, class _Arg>
00720 inline const_mem_fun1_ref_t<_Ret,_Tp,_Arg>
00721 mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const)
00722 { return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
00723
00724 }
00725
00726 #endif
00727
00728
00729
00730