libstdc++
|
00001 // Functor implementations -*- C++ -*- 00002 00003 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 00004 // Free Software Foundation, Inc. 00005 // 00006 // This file is part of the GNU ISO C++ Library. This library is free 00007 // software; you can redistribute it and/or modify it under the 00008 // terms of the GNU General Public License as published by the 00009 // Free Software Foundation; either version 3, or (at your option) 00010 // any later version. 00011 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 00017 // Under Section 7 of GPL version 3, you are granted additional 00018 // permissions described in the GCC Runtime Library Exception, version 00019 // 3.1, as published by the Free Software Foundation. 00020 00021 // You should have received a copy of the GNU General Public License and 00022 // a copy of the GCC Runtime Library Exception along with this program; 00023 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00024 // <http://www.gnu.org/licenses/>. 00025 00026 /* 00027 * 00028 * Copyright (c) 1994 00029 * Hewlett-Packard Company 00030 * 00031 * Permission to use, copy, modify, distribute and sell this software 00032 * and its documentation for any purpose is hereby granted without fee, 00033 * provided that the above copyright notice appear in all copies and 00034 * that both that copyright notice and this permission notice appear 00035 * in supporting documentation. Hewlett-Packard Company makes no 00036 * representations about the suitability of this software for any 00037 * purpose. It is provided "as is" without express or implied warranty. 00038 * 00039 * 00040 * Copyright (c) 1996-1998 00041 * Silicon Graphics Computer Systems, Inc. 00042 * 00043 * Permission to use, copy, modify, distribute and sell this software 00044 * and its documentation for any purpose is hereby granted without fee, 00045 * provided that the above copyright notice appear in all copies and 00046 * that both that copyright notice and this permission notice appear 00047 * in supporting documentation. Silicon Graphics makes no 00048 * representations about the suitability of this software for any 00049 * purpose. It is provided "as is" without express or implied warranty. 00050 */ 00051 00052 /** @file stl_function.h 00053 * This is an internal header file, included by other library headers. 00054 * You should not attempt to use it directly. 00055 */ 00056 00057 #ifndef _STL_FUNCTION_H 00058 #define _STL_FUNCTION_H 1 00059 00060 _GLIBCXX_BEGIN_NAMESPACE(std) 00061 00062 // 20.3.1 base classes 00063 /** @defgroup functors Function Objects 00064 * @ingroup utilities 00065 * 00066 * Function objects, or @e functors, are objects with an @c operator() 00067 * defined and accessible. They can be passed as arguments to algorithm 00068 * templates and used in place of a function pointer. Not only is the 00069 * resulting expressiveness of the library increased, but the generated 00070 * code can be more efficient than what you might write by hand. When we 00071 * refer to "functors," then, generally we include function pointers in 00072 * the description as well. 00073 * 00074 * Often, functors are only created as temporaries passed to algorithm 00075 * calls, rather than being created as named variables. 00076 * 00077 * Two examples taken from the standard itself follow. To perform a 00078 * by-element addition of two vectors @c a and @c b containing @c double, 00079 * and put the result in @c a, use 00080 * \code 00081 * transform (a.begin(), a.end(), b.begin(), a.begin(), plus<double>()); 00082 * \endcode 00083 * To negate every element in @c a, use 00084 * \code 00085 * transform(a.begin(), a.end(), a.begin(), negate<double>()); 00086 * \endcode 00087 * The addition and negation functions will be inlined directly. 00088 * 00089 * The standard functors are derived from structs named @c unary_function 00090 * and @c binary_function. These two classes contain nothing but typedefs, 00091 * to aid in generic (template) programming. If you write your own 00092 * functors, you might consider doing the same. 00093 * 00094 * @{ 00095 */ 00096 /** 00097 * This is one of the @link functors functor base classes@endlink. 00098 */ 00099 template<typename _Arg, typename _Result> 00100 struct unary_function 00101 { 00102 typedef _Arg argument_type; ///< @c argument_type is the type of the 00103 /// argument (no surprises here) 00104 00105 typedef _Result result_type; ///< @c result_type is the return type 00106 }; 00107 00108 /** 00109 * This is one of the @link functors functor base classes@endlink. 00110 */ 00111 template<typename _Arg1, typename _Arg2, typename _Result> 00112 struct binary_function 00113 { 00114 typedef _Arg1 first_argument_type; ///< the type of the first argument 00115 /// (no surprises here) 00116 00117 typedef _Arg2 second_argument_type; ///< the type of the second argument 00118 typedef _Result result_type; ///< type of the return type 00119 }; 00120 /** @} */ 00121 00122 // 20.3.2 arithmetic 00123 /** @defgroup arithmetic_functors Arithmetic Classes 00124 * @ingroup functors 00125 * 00126 * Because basic math often needs to be done during an algorithm, 00127 * the library provides functors for those operations. See the 00128 * documentation for @link functors the base classes@endlink 00129 * for examples of their use. 00130 * 00131 * @{ 00132 */ 00133 /// One of the @link arithmetic_functors math functors@endlink. 00134 template<typename _Tp> 00135 struct plus : public binary_function<_Tp, _Tp, _Tp> 00136 { 00137 _Tp 00138 operator()(const _Tp& __x, const _Tp& __y) const 00139 { return __x + __y; } 00140 }; 00141 00142 /// One of the @link arithmetic_functors math functors@endlink. 00143 template<typename _Tp> 00144 struct minus : public binary_function<_Tp, _Tp, _Tp> 00145 { 00146 _Tp 00147 operator()(const _Tp& __x, const _Tp& __y) const 00148 { return __x - __y; } 00149 }; 00150 00151 /// One of the @link arithmetic_functors math functors@endlink. 00152 template<typename _Tp> 00153 struct multiplies : public binary_function<_Tp, _Tp, _Tp> 00154 { 00155 _Tp 00156 operator()(const _Tp& __x, const _Tp& __y) const 00157 { return __x * __y; } 00158 }; 00159 00160 /// One of the @link arithmetic_functors math functors@endlink. 00161 template<typename _Tp> 00162 struct divides : public binary_function<_Tp, _Tp, _Tp> 00163 { 00164 _Tp 00165 operator()(const _Tp& __x, const _Tp& __y) const 00166 { return __x / __y; } 00167 }; 00168 00169 /// One of the @link arithmetic_functors math functors@endlink. 00170 template<typename _Tp> 00171 struct modulus : public binary_function<_Tp, _Tp, _Tp> 00172 { 00173 _Tp 00174 operator()(const _Tp& __x, const _Tp& __y) const 00175 { return __x % __y; } 00176 }; 00177 00178 /// One of the @link arithmetic_functors math functors@endlink. 00179 template<typename _Tp> 00180 struct negate : public unary_function<_Tp, _Tp> 00181 { 00182 _Tp 00183 operator()(const _Tp& __x) const 00184 { return -__x; } 00185 }; 00186 /** @} */ 00187 00188 // 20.3.3 comparisons 00189 /** @defgroup comparison_functors Comparison Classes 00190 * @ingroup functors 00191 * 00192 * The library provides six wrapper functors for all the basic comparisons 00193 * in C++, like @c <. 00194 * 00195 * @{ 00196 */ 00197 /// One of the @link comparison_functors comparison functors@endlink. 00198 template<typename _Tp> 00199 struct equal_to : public binary_function<_Tp, _Tp, bool> 00200 { 00201 bool 00202 operator()(const _Tp& __x, const _Tp& __y) const 00203 { return __x == __y; } 00204 }; 00205 00206 /// One of the @link comparison_functors comparison functors@endlink. 00207 template<typename _Tp> 00208 struct not_equal_to : public binary_function<_Tp, _Tp, bool> 00209 { 00210 bool 00211 operator()(const _Tp& __x, const _Tp& __y) const 00212 { return __x != __y; } 00213 }; 00214 00215 /// One of the @link comparison_functors comparison functors@endlink. 00216 template<typename _Tp> 00217 struct greater : public binary_function<_Tp, _Tp, bool> 00218 { 00219 bool 00220 operator()(const _Tp& __x, const _Tp& __y) const 00221 { return __x > __y; } 00222 }; 00223 00224 /// One of the @link comparison_functors comparison functors@endlink. 00225 template<typename _Tp> 00226 struct less : public binary_function<_Tp, _Tp, bool> 00227 { 00228 bool 00229 operator()(const _Tp& __x, const _Tp& __y) const 00230 { return __x < __y; } 00231 }; 00232 00233 /// One of the @link comparison_functors comparison functors@endlink. 00234 template<typename _Tp> 00235 struct greater_equal : public binary_function<_Tp, _Tp, bool> 00236 { 00237 bool 00238 operator()(const _Tp& __x, const _Tp& __y) const 00239 { return __x >= __y; } 00240 }; 00241 00242 /// One of the @link comparison_functors comparison functors@endlink. 00243 template<typename _Tp> 00244 struct less_equal : public binary_function<_Tp, _Tp, bool> 00245 { 00246 bool 00247 operator()(const _Tp& __x, const _Tp& __y) const 00248 { return __x <= __y; } 00249 }; 00250 /** @} */ 00251 00252 // 20.3.4 logical operations 00253 /** @defgroup logical_functors Boolean Operations Classes 00254 * @ingroup functors 00255 * 00256 * Here are wrapper functors for Boolean operations: @c &&, @c ||, 00257 * and @c !. 00258 * 00259 * @{ 00260 */ 00261 /// One of the @link logical_functors Boolean operations functors@endlink. 00262 template<typename _Tp> 00263 struct logical_and : public binary_function<_Tp, _Tp, bool> 00264 { 00265 bool 00266 operator()(const _Tp& __x, const _Tp& __y) const 00267 { return __x && __y; } 00268 }; 00269 00270 /// One of the @link logical_functors Boolean operations functors@endlink. 00271 template<typename _Tp> 00272 struct logical_or : public binary_function<_Tp, _Tp, bool> 00273 { 00274 bool 00275 operator()(const _Tp& __x, const _Tp& __y) const 00276 { return __x || __y; } 00277 }; 00278 00279 /// One of the @link logical_functors Boolean operations functors@endlink. 00280 template<typename _Tp> 00281 struct logical_not : public unary_function<_Tp, bool> 00282 { 00283 bool 00284 operator()(const _Tp& __x) const 00285 { return !__x; } 00286 }; 00287 /** @} */ 00288 00289 // _GLIBCXX_RESOLVE_LIB_DEFECTS 00290 // DR 660. Missing Bitwise Operations. 00291 template<typename _Tp> 00292 struct bit_and : public binary_function<_Tp, _Tp, _Tp> 00293 { 00294 _Tp 00295 operator()(const _Tp& __x, const _Tp& __y) const 00296 { return __x & __y; } 00297 }; 00298 00299 template<typename _Tp> 00300 struct bit_or : public binary_function<_Tp, _Tp, _Tp> 00301 { 00302 _Tp 00303 operator()(const _Tp& __x, const _Tp& __y) const 00304 { return __x | __y; } 00305 }; 00306 00307 template<typename _Tp> 00308 struct bit_xor : public binary_function<_Tp, _Tp, _Tp> 00309 { 00310 _Tp 00311 operator()(const _Tp& __x, const _Tp& __y) const 00312 { return __x ^ __y; } 00313 }; 00314 00315 // 20.3.5 negators 00316 /** @defgroup negators Negators 00317 * @ingroup functors 00318 * 00319 * The functions @c not1 and @c not2 each take a predicate functor 00320 * and return an instance of @c unary_negate or 00321 * @c binary_negate, respectively. These classes are functors whose 00322 * @c operator() performs the stored predicate function and then returns 00323 * the negation of the result. 00324 * 00325 * For example, given a vector of integers and a trivial predicate, 00326 * \code 00327 * struct IntGreaterThanThree 00328 * : public std::unary_function<int, bool> 00329 * { 00330 * bool operator() (int x) { return x > 3; } 00331 * }; 00332 * 00333 * std::find_if (v.begin(), v.end(), not1(IntGreaterThanThree())); 00334 * \endcode 00335 * The call to @c find_if will locate the first index (i) of @c v for which 00336 * "!(v[i] > 3)" is true. 00337 * 00338 * The not1/unary_negate combination works on predicates taking a single 00339 * argument. The not2/binary_negate combination works on predicates which 00340 * take two arguments. 00341 * 00342 * @{ 00343 */ 00344 /// One of the @link negators negation functors@endlink. 00345 template<typename _Predicate> 00346 class unary_negate 00347 : public unary_function<typename _Predicate::argument_type, bool> 00348 { 00349 protected: 00350 _Predicate _M_pred; 00351 00352 public: 00353 explicit 00354 unary_negate(const _Predicate& __x) : _M_pred(__x) { } 00355 00356 bool 00357 operator()(const typename _Predicate::argument_type& __x) const 00358 { return !_M_pred(__x); } 00359 }; 00360 00361 /// One of the @link negators negation functors@endlink. 00362 template<typename _Predicate> 00363 inline unary_negate<_Predicate> 00364 not1(const _Predicate& __pred) 00365 { return unary_negate<_Predicate>(__pred); } 00366 00367 /// One of the @link negators negation functors@endlink. 00368 template<typename _Predicate> 00369 class binary_negate 00370 : public binary_function<typename _Predicate::first_argument_type, 00371 typename _Predicate::second_argument_type, bool> 00372 { 00373 protected: 00374 _Predicate _M_pred; 00375 00376 public: 00377 explicit 00378 binary_negate(const _Predicate& __x) : _M_pred(__x) { } 00379 00380 bool 00381 operator()(const typename _Predicate::first_argument_type& __x, 00382 const typename _Predicate::second_argument_type& __y) const 00383 { return !_M_pred(__x, __y); } 00384 }; 00385 00386 /// One of the @link negators negation functors@endlink. 00387 template<typename _Predicate> 00388 inline binary_negate<_Predicate> 00389 not2(const _Predicate& __pred) 00390 { return binary_negate<_Predicate>(__pred); } 00391 /** @} */ 00392 00393 // 20.3.7 adaptors pointers functions 00394 /** @defgroup pointer_adaptors Adaptors for pointers to functions 00395 * @ingroup functors 00396 * 00397 * The advantage of function objects over pointers to functions is that 00398 * the objects in the standard library declare nested typedefs describing 00399 * their argument and result types with uniform names (e.g., @c result_type 00400 * from the base classes @c unary_function and @c binary_function). 00401 * Sometimes those typedefs are required, not just optional. 00402 * 00403 * Adaptors are provided to turn pointers to unary (single-argument) and 00404 * binary (double-argument) functions into function objects. The 00405 * long-winded functor @c pointer_to_unary_function is constructed with a 00406 * function pointer @c f, and its @c operator() called with argument @c x 00407 * returns @c f(x). The functor @c pointer_to_binary_function does the same 00408 * thing, but with a double-argument @c f and @c operator(). 00409 * 00410 * The function @c ptr_fun takes a pointer-to-function @c f and constructs 00411 * an instance of the appropriate functor. 00412 * 00413 * @{ 00414 */ 00415 /// One of the @link pointer_adaptors adaptors for function pointers@endlink. 00416 template<typename _Arg, typename _Result> 00417 class pointer_to_unary_function : public unary_function<_Arg, _Result> 00418 { 00419 protected: 00420 _Result (*_M_ptr)(_Arg); 00421 00422 public: 00423 pointer_to_unary_function() { } 00424 00425 explicit 00426 pointer_to_unary_function(_Result (*__x)(_Arg)) 00427 : _M_ptr(__x) { } 00428 00429 _Result 00430 operator()(_Arg __x) const 00431 { return _M_ptr(__x); } 00432 }; 00433 00434 /// One of the @link pointer_adaptors adaptors for function pointers@endlink. 00435 template<typename _Arg, typename _Result> 00436 inline pointer_to_unary_function<_Arg, _Result> 00437 ptr_fun(_Result (*__x)(_Arg)) 00438 { return pointer_to_unary_function<_Arg, _Result>(__x); } 00439 00440 /// One of the @link pointer_adaptors adaptors for function pointers@endlink. 00441 template<typename _Arg1, typename _Arg2, typename _Result> 00442 class pointer_to_binary_function 00443 : public binary_function<_Arg1, _Arg2, _Result> 00444 { 00445 protected: 00446 _Result (*_M_ptr)(_Arg1, _Arg2); 00447 00448 public: 00449 pointer_to_binary_function() { } 00450 00451 explicit 00452 pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2)) 00453 : _M_ptr(__x) { } 00454 00455 _Result 00456 operator()(_Arg1 __x, _Arg2 __y) const 00457 { return _M_ptr(__x, __y); } 00458 }; 00459 00460 /// One of the @link pointer_adaptors adaptors for function pointers@endlink. 00461 template<typename _Arg1, typename _Arg2, typename _Result> 00462 inline pointer_to_binary_function<_Arg1, _Arg2, _Result> 00463 ptr_fun(_Result (*__x)(_Arg1, _Arg2)) 00464 { return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x); } 00465 /** @} */ 00466 00467 template<typename _Tp> 00468 struct _Identity : public unary_function<_Tp,_Tp> 00469 { 00470 _Tp& 00471 operator()(_Tp& __x) const 00472 { return __x; } 00473 00474 const _Tp& 00475 operator()(const _Tp& __x) const 00476 { return __x; } 00477 }; 00478 00479 template<typename _Pair> 00480 struct _Select1st : public unary_function<_Pair, 00481 typename _Pair::first_type> 00482 { 00483 typename _Pair::first_type& 00484 operator()(_Pair& __x) const 00485 { return __x.first; } 00486 00487 const typename _Pair::first_type& 00488 operator()(const _Pair& __x) const 00489 { return __x.first; } 00490 }; 00491 00492 template<typename _Pair> 00493 struct _Select2nd : public unary_function<_Pair, 00494 typename _Pair::second_type> 00495 { 00496 typename _Pair::second_type& 00497 operator()(_Pair& __x) const 00498 { return __x.second; } 00499 00500 const typename _Pair::second_type& 00501 operator()(const _Pair& __x) const 00502 { return __x.second; } 00503 }; 00504 00505 // 20.3.8 adaptors pointers members 00506 /** @defgroup memory_adaptors Adaptors for pointers to members 00507 * @ingroup functors 00508 * 00509 * There are a total of 8 = 2^3 function objects in this family. 00510 * (1) Member functions taking no arguments vs member functions taking 00511 * one argument. 00512 * (2) Call through pointer vs call through reference. 00513 * (3) Const vs non-const member function. 00514 * 00515 * All of this complexity is in the function objects themselves. You can 00516 * ignore it by using the helper function mem_fun and mem_fun_ref, 00517 * which create whichever type of adaptor is appropriate. 00518 * 00519 * @{ 00520 */ 00521 /// One of the @link memory_adaptors adaptors for member 00522 /// pointers@endlink. 00523 template<typename _Ret, typename _Tp> 00524 class mem_fun_t : public unary_function<_Tp*, _Ret> 00525 { 00526 public: 00527 explicit 00528 mem_fun_t(_Ret (_Tp::*__pf)()) 00529 : _M_f(__pf) { } 00530 00531 _Ret 00532 operator()(_Tp* __p) const 00533 { return (__p->*_M_f)(); } 00534 00535 private: 00536 _Ret (_Tp::*_M_f)(); 00537 }; 00538 00539 /// One of the @link memory_adaptors adaptors for member 00540 /// pointers@endlink. 00541 template<typename _Ret, typename _Tp> 00542 class const_mem_fun_t : public unary_function<const _Tp*, _Ret> 00543 { 00544 public: 00545 explicit 00546 const_mem_fun_t(_Ret (_Tp::*__pf)() const) 00547 : _M_f(__pf) { } 00548 00549 _Ret 00550 operator()(const _Tp* __p) const 00551 { return (__p->*_M_f)(); } 00552 00553 private: 00554 _Ret (_Tp::*_M_f)() const; 00555 }; 00556 00557 /// One of the @link memory_adaptors adaptors for member 00558 /// pointers@endlink. 00559 template<typename _Ret, typename _Tp> 00560 class mem_fun_ref_t : public unary_function<_Tp, _Ret> 00561 { 00562 public: 00563 explicit 00564 mem_fun_ref_t(_Ret (_Tp::*__pf)()) 00565 : _M_f(__pf) { } 00566 00567 _Ret 00568 operator()(_Tp& __r) const 00569 { return (__r.*_M_f)(); } 00570 00571 private: 00572 _Ret (_Tp::*_M_f)(); 00573 }; 00574 00575 /// One of the @link memory_adaptors adaptors for member 00576 /// pointers@endlink. 00577 template<typename _Ret, typename _Tp> 00578 class const_mem_fun_ref_t : public unary_function<_Tp, _Ret> 00579 { 00580 public: 00581 explicit 00582 const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) 00583 : _M_f(__pf) { } 00584 00585 _Ret 00586 operator()(const _Tp& __r) const 00587 { return (__r.*_M_f)(); } 00588 00589 private: 00590 _Ret (_Tp::*_M_f)() const; 00591 }; 00592 00593 /// One of the @link memory_adaptors adaptors for member 00594 /// pointers@endlink. 00595 template<typename _Ret, typename _Tp, typename _Arg> 00596 class mem_fun1_t : public binary_function<_Tp*, _Arg, _Ret> 00597 { 00598 public: 00599 explicit 00600 mem_fun1_t(_Ret (_Tp::*__pf)(_Arg)) 00601 : _M_f(__pf) { } 00602 00603 _Ret 00604 operator()(_Tp* __p, _Arg __x) const 00605 { return (__p->*_M_f)(__x); } 00606 00607 private: 00608 _Ret (_Tp::*_M_f)(_Arg); 00609 }; 00610 00611 /// One of the @link memory_adaptors adaptors for member 00612 /// pointers@endlink. 00613 template<typename _Ret, typename _Tp, typename _Arg> 00614 class const_mem_fun1_t : public binary_function<const _Tp*, _Arg, _Ret> 00615 { 00616 public: 00617 explicit 00618 const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const) 00619 : _M_f(__pf) { } 00620 00621 _Ret 00622 operator()(const _Tp* __p, _Arg __x) const 00623 { return (__p->*_M_f)(__x); } 00624 00625 private: 00626 _Ret (_Tp::*_M_f)(_Arg) const; 00627 }; 00628 00629 /// One of the @link memory_adaptors adaptors for member 00630 /// pointers@endlink. 00631 template<typename _Ret, typename _Tp, typename _Arg> 00632 class mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> 00633 { 00634 public: 00635 explicit 00636 mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg)) 00637 : _M_f(__pf) { } 00638 00639 _Ret 00640 operator()(_Tp& __r, _Arg __x) const 00641 { return (__r.*_M_f)(__x); } 00642 00643 private: 00644 _Ret (_Tp::*_M_f)(_Arg); 00645 }; 00646 00647 /// One of the @link memory_adaptors adaptors for member 00648 /// pointers@endlink. 00649 template<typename _Ret, typename _Tp, typename _Arg> 00650 class const_mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret> 00651 { 00652 public: 00653 explicit 00654 const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const) 00655 : _M_f(__pf) { } 00656 00657 _Ret 00658 operator()(const _Tp& __r, _Arg __x) const 00659 { return (__r.*_M_f)(__x); } 00660 00661 private: 00662 _Ret (_Tp::*_M_f)(_Arg) const; 00663 }; 00664 00665 // Mem_fun adaptor helper functions. There are only two: 00666 // mem_fun and mem_fun_ref. 00667 template<typename _Ret, typename _Tp> 00668 inline mem_fun_t<_Ret, _Tp> 00669 mem_fun(_Ret (_Tp::*__f)()) 00670 { return mem_fun_t<_Ret, _Tp>(__f); } 00671 00672 template<typename _Ret, typename _Tp> 00673 inline const_mem_fun_t<_Ret, _Tp> 00674 mem_fun(_Ret (_Tp::*__f)() const) 00675 { return const_mem_fun_t<_Ret, _Tp>(__f); } 00676 00677 template<typename _Ret, typename _Tp> 00678 inline mem_fun_ref_t<_Ret, _Tp> 00679 mem_fun_ref(_Ret (_Tp::*__f)()) 00680 { return mem_fun_ref_t<_Ret, _Tp>(__f); } 00681 00682 template<typename _Ret, typename _Tp> 00683 inline const_mem_fun_ref_t<_Ret, _Tp> 00684 mem_fun_ref(_Ret (_Tp::*__f)() const) 00685 { return const_mem_fun_ref_t<_Ret, _Tp>(__f); } 00686 00687 template<typename _Ret, typename _Tp, typename _Arg> 00688 inline mem_fun1_t<_Ret, _Tp, _Arg> 00689 mem_fun(_Ret (_Tp::*__f)(_Arg)) 00690 { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); } 00691 00692 template<typename _Ret, typename _Tp, typename _Arg> 00693 inline const_mem_fun1_t<_Ret, _Tp, _Arg> 00694 mem_fun(_Ret (_Tp::*__f)(_Arg) const) 00695 { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); } 00696 00697 template<typename _Ret, typename _Tp, typename _Arg> 00698 inline mem_fun1_ref_t<_Ret, _Tp, _Arg> 00699 mem_fun_ref(_Ret (_Tp::*__f)(_Arg)) 00700 { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); } 00701 00702 template<typename _Ret, typename _Tp, typename _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 /** @} */ 00708 00709 _GLIBCXX_END_NAMESPACE 00710 00711 #if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_DEPRECATED 00712 # include <backward/binders.h> 00713 #endif 00714 00715 #endif /* _STL_FUNCTION_H */