*: Use headername alias to associate private includes to public includes.
[gcc.git] / libstdc++-v3 / include / bits / stl_function.h
1 // Functor implementations -*- C++ -*-
2
3 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
4 // Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16
17 // Under Section 7 of GPL version 3, you are granted additional
18 // permissions described in the GCC Runtime Library Exception, version
19 // 3.1, as published by the Free Software Foundation.
20
21 // You should have received a copy of the GNU General Public License and
22 // a copy of the GCC Runtime Library Exception along with this program;
23 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 // <http://www.gnu.org/licenses/>.
25
26 /*
27 *
28 * Copyright (c) 1994
29 * Hewlett-Packard Company
30 *
31 * Permission to use, copy, modify, distribute and sell this software
32 * and its documentation for any purpose is hereby granted without fee,
33 * provided that the above copyright notice appear in all copies and
34 * that both that copyright notice and this permission notice appear
35 * in supporting documentation. Hewlett-Packard Company makes no
36 * representations about the suitability of this software for any
37 * purpose. It is provided "as is" without express or implied warranty.
38 *
39 *
40 * Copyright (c) 1996-1998
41 * Silicon Graphics Computer Systems, Inc.
42 *
43 * Permission to use, copy, modify, distribute and sell this software
44 * and its documentation for any purpose is hereby granted without fee,
45 * provided that the above copyright notice appear in all copies and
46 * that both that copyright notice and this permission notice appear
47 * in supporting documentation. Silicon Graphics makes no
48 * representations about the suitability of this software for any
49 * purpose. It is provided "as is" without express or implied warranty.
50 */
51
52 /** @file bits/stl_function.h
53 * This is an internal header file, included by other library headers.
54 * Do not attempt to use it directly. @headername{functional}
55 */
56
57 #ifndef _STL_FUNCTION_H
58 #define _STL_FUNCTION_H 1
59
60 _GLIBCXX_BEGIN_NAMESPACE(std)
61
62 // 20.3.1 base classes
63 /** @defgroup functors Function Objects
64 * @ingroup utilities
65 *
66 * Function objects, or @e functors, are objects with an @c operator()
67 * defined and accessible. They can be passed as arguments to algorithm
68 * templates and used in place of a function pointer. Not only is the
69 * resulting expressiveness of the library increased, but the generated
70 * code can be more efficient than what you might write by hand. When we
71 * refer to @a functors, then, generally we include function pointers in
72 * the description as well.
73 *
74 * Often, functors are only created as temporaries passed to algorithm
75 * calls, rather than being created as named variables.
76 *
77 * Two examples taken from the standard itself follow. To perform a
78 * by-element addition of two vectors @c a and @c b containing @c double,
79 * and put the result in @c a, use
80 * \code
81 * transform (a.begin(), a.end(), b.begin(), a.begin(), plus<double>());
82 * \endcode
83 * To negate every element in @c a, use
84 * \code
85 * transform(a.begin(), a.end(), a.begin(), negate<double>());
86 * \endcode
87 * The addition and negation functions will be inlined directly.
88 *
89 * The standard functors are derived from structs named @c unary_function
90 * and @c binary_function. These two classes contain nothing but typedefs,
91 * to aid in generic (template) programming. If you write your own
92 * functors, you might consider doing the same.
93 *
94 * @{
95 */
96 /**
97 * This is one of the @link functors functor base classes@endlink.
98 */
99 template<typename _Arg, typename _Result>
100 struct unary_function
101 {
102 /// @c argument_type is the type of the argument
103 typedef _Arg argument_type;
104
105 /// @c result_type is the return type
106 typedef _Result result_type;
107 };
108
109 /**
110 * This is one of the @link functors functor base classes@endlink.
111 */
112 template<typename _Arg1, typename _Arg2, typename _Result>
113 struct binary_function
114 {
115 /// @c first_argument_type is the type of the first argument
116 typedef _Arg1 first_argument_type;
117
118 /// @c second_argument_type is the type of the second argument
119 typedef _Arg2 second_argument_type;
120
121 /// @c result_type is the return type
122 typedef _Result result_type;
123 };
124 /** @} */
125
126 // 20.3.2 arithmetic
127 /** @defgroup arithmetic_functors Arithmetic Classes
128 * @ingroup functors
129 *
130 * Because basic math often needs to be done during an algorithm,
131 * the library provides functors for those operations. See the
132 * documentation for @link functors the base classes@endlink
133 * for examples of their use.
134 *
135 * @{
136 */
137 /// One of the @link arithmetic_functors math functors@endlink.
138 template<typename _Tp>
139 struct plus : public binary_function<_Tp, _Tp, _Tp>
140 {
141 _Tp
142 operator()(const _Tp& __x, const _Tp& __y) const
143 { return __x + __y; }
144 };
145
146 /// One of the @link arithmetic_functors math functors@endlink.
147 template<typename _Tp>
148 struct minus : public binary_function<_Tp, _Tp, _Tp>
149 {
150 _Tp
151 operator()(const _Tp& __x, const _Tp& __y) const
152 { return __x - __y; }
153 };
154
155 /// One of the @link arithmetic_functors math functors@endlink.
156 template<typename _Tp>
157 struct multiplies : public binary_function<_Tp, _Tp, _Tp>
158 {
159 _Tp
160 operator()(const _Tp& __x, const _Tp& __y) const
161 { return __x * __y; }
162 };
163
164 /// One of the @link arithmetic_functors math functors@endlink.
165 template<typename _Tp>
166 struct divides : public binary_function<_Tp, _Tp, _Tp>
167 {
168 _Tp
169 operator()(const _Tp& __x, const _Tp& __y) const
170 { return __x / __y; }
171 };
172
173 /// One of the @link arithmetic_functors math functors@endlink.
174 template<typename _Tp>
175 struct modulus : public binary_function<_Tp, _Tp, _Tp>
176 {
177 _Tp
178 operator()(const _Tp& __x, const _Tp& __y) const
179 { return __x % __y; }
180 };
181
182 /// One of the @link arithmetic_functors math functors@endlink.
183 template<typename _Tp>
184 struct negate : public unary_function<_Tp, _Tp>
185 {
186 _Tp
187 operator()(const _Tp& __x) const
188 { return -__x; }
189 };
190 /** @} */
191
192 // 20.3.3 comparisons
193 /** @defgroup comparison_functors Comparison Classes
194 * @ingroup functors
195 *
196 * The library provides six wrapper functors for all the basic comparisons
197 * in C++, like @c <.
198 *
199 * @{
200 */
201 /// One of the @link comparison_functors comparison functors@endlink.
202 template<typename _Tp>
203 struct equal_to : public binary_function<_Tp, _Tp, bool>
204 {
205 bool
206 operator()(const _Tp& __x, const _Tp& __y) const
207 { return __x == __y; }
208 };
209
210 /// One of the @link comparison_functors comparison functors@endlink.
211 template<typename _Tp>
212 struct not_equal_to : public binary_function<_Tp, _Tp, bool>
213 {
214 bool
215 operator()(const _Tp& __x, const _Tp& __y) const
216 { return __x != __y; }
217 };
218
219 /// One of the @link comparison_functors comparison functors@endlink.
220 template<typename _Tp>
221 struct greater : public binary_function<_Tp, _Tp, bool>
222 {
223 bool
224 operator()(const _Tp& __x, const _Tp& __y) const
225 { return __x > __y; }
226 };
227
228 /// One of the @link comparison_functors comparison functors@endlink.
229 template<typename _Tp>
230 struct less : public binary_function<_Tp, _Tp, bool>
231 {
232 bool
233 operator()(const _Tp& __x, const _Tp& __y) const
234 { return __x < __y; }
235 };
236
237 /// One of the @link comparison_functors comparison functors@endlink.
238 template<typename _Tp>
239 struct greater_equal : public binary_function<_Tp, _Tp, bool>
240 {
241 bool
242 operator()(const _Tp& __x, const _Tp& __y) const
243 { return __x >= __y; }
244 };
245
246 /// One of the @link comparison_functors comparison functors@endlink.
247 template<typename _Tp>
248 struct less_equal : public binary_function<_Tp, _Tp, bool>
249 {
250 bool
251 operator()(const _Tp& __x, const _Tp& __y) const
252 { return __x <= __y; }
253 };
254 /** @} */
255
256 // 20.3.4 logical operations
257 /** @defgroup logical_functors Boolean Operations Classes
258 * @ingroup functors
259 *
260 * Here are wrapper functors for Boolean operations: @c &&, @c ||,
261 * and @c !.
262 *
263 * @{
264 */
265 /// One of the @link logical_functors Boolean operations functors@endlink.
266 template<typename _Tp>
267 struct logical_and : public binary_function<_Tp, _Tp, bool>
268 {
269 bool
270 operator()(const _Tp& __x, const _Tp& __y) const
271 { return __x && __y; }
272 };
273
274 /// One of the @link logical_functors Boolean operations functors@endlink.
275 template<typename _Tp>
276 struct logical_or : public binary_function<_Tp, _Tp, bool>
277 {
278 bool
279 operator()(const _Tp& __x, const _Tp& __y) const
280 { return __x || __y; }
281 };
282
283 /// One of the @link logical_functors Boolean operations functors@endlink.
284 template<typename _Tp>
285 struct logical_not : public unary_function<_Tp, bool>
286 {
287 bool
288 operator()(const _Tp& __x) const
289 { return !__x; }
290 };
291 /** @} */
292
293 // _GLIBCXX_RESOLVE_LIB_DEFECTS
294 // DR 660. Missing Bitwise Operations.
295 template<typename _Tp>
296 struct bit_and : public binary_function<_Tp, _Tp, _Tp>
297 {
298 _Tp
299 operator()(const _Tp& __x, const _Tp& __y) const
300 { return __x & __y; }
301 };
302
303 template<typename _Tp>
304 struct bit_or : public binary_function<_Tp, _Tp, _Tp>
305 {
306 _Tp
307 operator()(const _Tp& __x, const _Tp& __y) const
308 { return __x | __y; }
309 };
310
311 template<typename _Tp>
312 struct bit_xor : public binary_function<_Tp, _Tp, _Tp>
313 {
314 _Tp
315 operator()(const _Tp& __x, const _Tp& __y) const
316 { return __x ^ __y; }
317 };
318
319 // 20.3.5 negators
320 /** @defgroup negators Negators
321 * @ingroup functors
322 *
323 * The functions @c not1 and @c not2 each take a predicate functor
324 * and return an instance of @c unary_negate or
325 * @c binary_negate, respectively. These classes are functors whose
326 * @c operator() performs the stored predicate function and then returns
327 * the negation of the result.
328 *
329 * For example, given a vector of integers and a trivial predicate,
330 * \code
331 * struct IntGreaterThanThree
332 * : public std::unary_function<int, bool>
333 * {
334 * bool operator() (int x) { return x > 3; }
335 * };
336 *
337 * std::find_if (v.begin(), v.end(), not1(IntGreaterThanThree()));
338 * \endcode
339 * The call to @c find_if will locate the first index (i) of @c v for which
340 * <code>!(v[i] > 3)</code> is true.
341 *
342 * The not1/unary_negate combination works on predicates taking a single
343 * argument. The not2/binary_negate combination works on predicates which
344 * take two arguments.
345 *
346 * @{
347 */
348 /// One of the @link negators negation functors@endlink.
349 template<typename _Predicate>
350 class unary_negate
351 : public unary_function<typename _Predicate::argument_type, bool>
352 {
353 protected:
354 _Predicate _M_pred;
355
356 public:
357 explicit
358 unary_negate(const _Predicate& __x) : _M_pred(__x) { }
359
360 bool
361 operator()(const typename _Predicate::argument_type& __x) const
362 { return !_M_pred(__x); }
363 };
364
365 /// One of the @link negators negation functors@endlink.
366 template<typename _Predicate>
367 inline unary_negate<_Predicate>
368 not1(const _Predicate& __pred)
369 { return unary_negate<_Predicate>(__pred); }
370
371 /// One of the @link negators negation functors@endlink.
372 template<typename _Predicate>
373 class binary_negate
374 : public binary_function<typename _Predicate::first_argument_type,
375 typename _Predicate::second_argument_type, bool>
376 {
377 protected:
378 _Predicate _M_pred;
379
380 public:
381 explicit
382 binary_negate(const _Predicate& __x) : _M_pred(__x) { }
383
384 bool
385 operator()(const typename _Predicate::first_argument_type& __x,
386 const typename _Predicate::second_argument_type& __y) const
387 { return !_M_pred(__x, __y); }
388 };
389
390 /// One of the @link negators negation functors@endlink.
391 template<typename _Predicate>
392 inline binary_negate<_Predicate>
393 not2(const _Predicate& __pred)
394 { return binary_negate<_Predicate>(__pred); }
395 /** @} */
396
397 // 20.3.7 adaptors pointers functions
398 /** @defgroup pointer_adaptors Adaptors for pointers to functions
399 * @ingroup functors
400 *
401 * The advantage of function objects over pointers to functions is that
402 * the objects in the standard library declare nested typedefs describing
403 * their argument and result types with uniform names (e.g., @c result_type
404 * from the base classes @c unary_function and @c binary_function).
405 * Sometimes those typedefs are required, not just optional.
406 *
407 * Adaptors are provided to turn pointers to unary (single-argument) and
408 * binary (double-argument) functions into function objects. The
409 * long-winded functor @c pointer_to_unary_function is constructed with a
410 * function pointer @c f, and its @c operator() called with argument @c x
411 * returns @c f(x). The functor @c pointer_to_binary_function does the same
412 * thing, but with a double-argument @c f and @c operator().
413 *
414 * The function @c ptr_fun takes a pointer-to-function @c f and constructs
415 * an instance of the appropriate functor.
416 *
417 * @{
418 */
419 /// One of the @link pointer_adaptors adaptors for function pointers@endlink.
420 template<typename _Arg, typename _Result>
421 class pointer_to_unary_function : public unary_function<_Arg, _Result>
422 {
423 protected:
424 _Result (*_M_ptr)(_Arg);
425
426 public:
427 pointer_to_unary_function() { }
428
429 explicit
430 pointer_to_unary_function(_Result (*__x)(_Arg))
431 : _M_ptr(__x) { }
432
433 _Result
434 operator()(_Arg __x) const
435 { return _M_ptr(__x); }
436 };
437
438 /// One of the @link pointer_adaptors adaptors for function pointers@endlink.
439 template<typename _Arg, typename _Result>
440 inline pointer_to_unary_function<_Arg, _Result>
441 ptr_fun(_Result (*__x)(_Arg))
442 { return pointer_to_unary_function<_Arg, _Result>(__x); }
443
444 /// One of the @link pointer_adaptors adaptors for function pointers@endlink.
445 template<typename _Arg1, typename _Arg2, typename _Result>
446 class pointer_to_binary_function
447 : public binary_function<_Arg1, _Arg2, _Result>
448 {
449 protected:
450 _Result (*_M_ptr)(_Arg1, _Arg2);
451
452 public:
453 pointer_to_binary_function() { }
454
455 explicit
456 pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2))
457 : _M_ptr(__x) { }
458
459 _Result
460 operator()(_Arg1 __x, _Arg2 __y) const
461 { return _M_ptr(__x, __y); }
462 };
463
464 /// One of the @link pointer_adaptors adaptors for function pointers@endlink.
465 template<typename _Arg1, typename _Arg2, typename _Result>
466 inline pointer_to_binary_function<_Arg1, _Arg2, _Result>
467 ptr_fun(_Result (*__x)(_Arg1, _Arg2))
468 { return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x); }
469 /** @} */
470
471 template<typename _Tp>
472 struct _Identity : public unary_function<_Tp,_Tp>
473 {
474 _Tp&
475 operator()(_Tp& __x) const
476 { return __x; }
477
478 const _Tp&
479 operator()(const _Tp& __x) const
480 { return __x; }
481 };
482
483 template<typename _Pair>
484 struct _Select1st : public unary_function<_Pair,
485 typename _Pair::first_type>
486 {
487 typename _Pair::first_type&
488 operator()(_Pair& __x) const
489 { return __x.first; }
490
491 const typename _Pair::first_type&
492 operator()(const _Pair& __x) const
493 { return __x.first; }
494
495 #ifdef __GXX_EXPERIMENTAL_CXX0X__
496 template<typename _Pair2>
497 typename _Pair2::first_type&
498 operator()(_Pair2& __x) const
499 { return __x.first; }
500
501 template<typename _Pair2>
502 const typename _Pair2::first_type&
503 operator()(const _Pair2& __x) const
504 { return __x.first; }
505 #endif
506 };
507
508 template<typename _Pair>
509 struct _Select2nd : public unary_function<_Pair,
510 typename _Pair::second_type>
511 {
512 typename _Pair::second_type&
513 operator()(_Pair& __x) const
514 { return __x.second; }
515
516 const typename _Pair::second_type&
517 operator()(const _Pair& __x) const
518 { return __x.second; }
519 };
520
521 // 20.3.8 adaptors pointers members
522 /** @defgroup memory_adaptors Adaptors for pointers to members
523 * @ingroup functors
524 *
525 * There are a total of 8 = 2^3 function objects in this family.
526 * (1) Member functions taking no arguments vs member functions taking
527 * one argument.
528 * (2) Call through pointer vs call through reference.
529 * (3) Const vs non-const member function.
530 *
531 * All of this complexity is in the function objects themselves. You can
532 * ignore it by using the helper function mem_fun and mem_fun_ref,
533 * which create whichever type of adaptor is appropriate.
534 *
535 * @{
536 */
537 /// One of the @link memory_adaptors adaptors for member
538 /// pointers@endlink.
539 template<typename _Ret, typename _Tp>
540 class mem_fun_t : public unary_function<_Tp*, _Ret>
541 {
542 public:
543 explicit
544 mem_fun_t(_Ret (_Tp::*__pf)())
545 : _M_f(__pf) { }
546
547 _Ret
548 operator()(_Tp* __p) const
549 { return (__p->*_M_f)(); }
550
551 private:
552 _Ret (_Tp::*_M_f)();
553 };
554
555 /// One of the @link memory_adaptors adaptors for member
556 /// pointers@endlink.
557 template<typename _Ret, typename _Tp>
558 class const_mem_fun_t : public unary_function<const _Tp*, _Ret>
559 {
560 public:
561 explicit
562 const_mem_fun_t(_Ret (_Tp::*__pf)() const)
563 : _M_f(__pf) { }
564
565 _Ret
566 operator()(const _Tp* __p) const
567 { return (__p->*_M_f)(); }
568
569 private:
570 _Ret (_Tp::*_M_f)() const;
571 };
572
573 /// One of the @link memory_adaptors adaptors for member
574 /// pointers@endlink.
575 template<typename _Ret, typename _Tp>
576 class mem_fun_ref_t : public unary_function<_Tp, _Ret>
577 {
578 public:
579 explicit
580 mem_fun_ref_t(_Ret (_Tp::*__pf)())
581 : _M_f(__pf) { }
582
583 _Ret
584 operator()(_Tp& __r) const
585 { return (__r.*_M_f)(); }
586
587 private:
588 _Ret (_Tp::*_M_f)();
589 };
590
591 /// One of the @link memory_adaptors adaptors for member
592 /// pointers@endlink.
593 template<typename _Ret, typename _Tp>
594 class const_mem_fun_ref_t : public unary_function<_Tp, _Ret>
595 {
596 public:
597 explicit
598 const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const)
599 : _M_f(__pf) { }
600
601 _Ret
602 operator()(const _Tp& __r) const
603 { return (__r.*_M_f)(); }
604
605 private:
606 _Ret (_Tp::*_M_f)() const;
607 };
608
609 /// One of the @link memory_adaptors adaptors for member
610 /// pointers@endlink.
611 template<typename _Ret, typename _Tp, typename _Arg>
612 class mem_fun1_t : public binary_function<_Tp*, _Arg, _Ret>
613 {
614 public:
615 explicit
616 mem_fun1_t(_Ret (_Tp::*__pf)(_Arg))
617 : _M_f(__pf) { }
618
619 _Ret
620 operator()(_Tp* __p, _Arg __x) const
621 { return (__p->*_M_f)(__x); }
622
623 private:
624 _Ret (_Tp::*_M_f)(_Arg);
625 };
626
627 /// One of the @link memory_adaptors adaptors for member
628 /// pointers@endlink.
629 template<typename _Ret, typename _Tp, typename _Arg>
630 class const_mem_fun1_t : public binary_function<const _Tp*, _Arg, _Ret>
631 {
632 public:
633 explicit
634 const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const)
635 : _M_f(__pf) { }
636
637 _Ret
638 operator()(const _Tp* __p, _Arg __x) const
639 { return (__p->*_M_f)(__x); }
640
641 private:
642 _Ret (_Tp::*_M_f)(_Arg) const;
643 };
644
645 /// One of the @link memory_adaptors adaptors for member
646 /// pointers@endlink.
647 template<typename _Ret, typename _Tp, typename _Arg>
648 class mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret>
649 {
650 public:
651 explicit
652 mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg))
653 : _M_f(__pf) { }
654
655 _Ret
656 operator()(_Tp& __r, _Arg __x) const
657 { return (__r.*_M_f)(__x); }
658
659 private:
660 _Ret (_Tp::*_M_f)(_Arg);
661 };
662
663 /// One of the @link memory_adaptors adaptors for member
664 /// pointers@endlink.
665 template<typename _Ret, typename _Tp, typename _Arg>
666 class const_mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret>
667 {
668 public:
669 explicit
670 const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const)
671 : _M_f(__pf) { }
672
673 _Ret
674 operator()(const _Tp& __r, _Arg __x) const
675 { return (__r.*_M_f)(__x); }
676
677 private:
678 _Ret (_Tp::*_M_f)(_Arg) const;
679 };
680
681 // Mem_fun adaptor helper functions. There are only two:
682 // mem_fun and mem_fun_ref.
683 template<typename _Ret, typename _Tp>
684 inline mem_fun_t<_Ret, _Tp>
685 mem_fun(_Ret (_Tp::*__f)())
686 { return mem_fun_t<_Ret, _Tp>(__f); }
687
688 template<typename _Ret, typename _Tp>
689 inline const_mem_fun_t<_Ret, _Tp>
690 mem_fun(_Ret (_Tp::*__f)() const)
691 { return const_mem_fun_t<_Ret, _Tp>(__f); }
692
693 template<typename _Ret, typename _Tp>
694 inline mem_fun_ref_t<_Ret, _Tp>
695 mem_fun_ref(_Ret (_Tp::*__f)())
696 { return mem_fun_ref_t<_Ret, _Tp>(__f); }
697
698 template<typename _Ret, typename _Tp>
699 inline const_mem_fun_ref_t<_Ret, _Tp>
700 mem_fun_ref(_Ret (_Tp::*__f)() const)
701 { return const_mem_fun_ref_t<_Ret, _Tp>(__f); }
702
703 template<typename _Ret, typename _Tp, typename _Arg>
704 inline mem_fun1_t<_Ret, _Tp, _Arg>
705 mem_fun(_Ret (_Tp::*__f)(_Arg))
706 { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
707
708 template<typename _Ret, typename _Tp, typename _Arg>
709 inline const_mem_fun1_t<_Ret, _Tp, _Arg>
710 mem_fun(_Ret (_Tp::*__f)(_Arg) const)
711 { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
712
713 template<typename _Ret, typename _Tp, typename _Arg>
714 inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
715 mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
716 { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
717
718 template<typename _Ret, typename _Tp, typename _Arg>
719 inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
720 mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)
721 { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
722
723 /** @} */
724
725 _GLIBCXX_END_NAMESPACE
726
727 #if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_DEPRECATED
728 # include <backward/binders.h>
729 #endif
730
731 #endif /* _STL_FUNCTION_H */