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