57 #ifndef _STL_FUNCTION_H
58 #define _STL_FUNCTION_H 1
60 namespace std _GLIBCXX_VISIBILITY(default)
62 _GLIBCXX_BEGIN_NAMESPACE_VERSION
101 template<
typename _Arg,
typename _Result>
114 template<
typename _Arg1,
typename _Arg2,
typename _Result>
140 template<
typename _Tp>
144 operator()(
const _Tp& __x,
const _Tp& __y)
const
145 {
return __x + __y; }
149 template<
typename _Tp>
153 operator()(
const _Tp& __x,
const _Tp& __y)
const
154 {
return __x - __y; }
158 template<
typename _Tp>
162 operator()(
const _Tp& __x,
const _Tp& __y)
const
163 {
return __x * __y; }
167 template<
typename _Tp>
171 operator()(
const _Tp& __x,
const _Tp& __y)
const
172 {
return __x / __y; }
176 template<
typename _Tp>
180 operator()(
const _Tp& __x,
const _Tp& __y)
const
181 {
return __x % __y; }
185 template<
typename _Tp>
189 operator()(
const _Tp& __x)
const
204 template<
typename _Tp>
208 operator()(
const _Tp& __x,
const _Tp& __y)
const
209 {
return __x == __y; }
213 template<
typename _Tp>
217 operator()(
const _Tp& __x,
const _Tp& __y)
const
218 {
return __x != __y; }
222 template<
typename _Tp>
226 operator()(
const _Tp& __x,
const _Tp& __y)
const
227 {
return __x > __y; }
231 template<
typename _Tp>
235 operator()(
const _Tp& __x,
const _Tp& __y)
const
236 {
return __x < __y; }
240 template<
typename _Tp>
244 operator()(
const _Tp& __x,
const _Tp& __y)
const
245 {
return __x >= __y; }
249 template<
typename _Tp>
253 operator()(
const _Tp& __x,
const _Tp& __y)
const
254 {
return __x <= __y; }
268 template<
typename _Tp>
272 operator()(
const _Tp& __x,
const _Tp& __y)
const
273 {
return __x && __y; }
277 template<
typename _Tp>
281 operator()(
const _Tp& __x,
const _Tp& __y)
const
282 {
return __x || __y; }
286 template<
typename _Tp>
290 operator()(
const _Tp& __x)
const
297 template<
typename _Tp>
301 operator()(
const _Tp& __x,
const _Tp& __y)
const
302 {
return __x & __y; }
305 template<
typename _Tp>
306 struct bit_or :
public binary_function<_Tp, _Tp, _Tp>
309 operator()(
const _Tp& __x,
const _Tp& __y)
const
310 {
return __x | __y; }
313 template<
typename _Tp>
314 struct bit_xor :
public binary_function<_Tp, _Tp, _Tp>
317 operator()(
const _Tp& __x,
const _Tp& __y)
const
318 {
return __x ^ __y; }
351 template<
typename _Predicate>
363 operator()(
const typename _Predicate::argument_type& __x)
const
364 {
return !_M_pred(__x); }
368 template<
typename _Predicate>
374 template<
typename _Predicate>
377 typename _Predicate::second_argument_type, bool>
387 operator()(
const typename _Predicate::first_argument_type& __x,
388 const typename _Predicate::second_argument_type& __y)
const
389 {
return !_M_pred(__x, __y); }
393 template<
typename _Predicate>
422 template<
typename _Arg,
typename _Result>
426 _Result (*_M_ptr)(_Arg);
436 operator()(_Arg __x)
const
437 {
return _M_ptr(__x); }
441 template<
typename _Arg,
typename _Result>
447 template<
typename _Arg1,
typename _Arg2,
typename _Result>
452 _Result (*_M_ptr)(_Arg1, _Arg2);
462 operator()(_Arg1 __x, _Arg2 __y)
const
463 {
return _M_ptr(__x, __y); }
467 template<
typename _Arg1,
typename _Arg2,
typename _Result>
473 template<
typename _Tp>
474 struct _Identity :
public unary_function<_Tp,_Tp>
477 operator()(_Tp& __x)
const
481 operator()(
const _Tp& __x)
const
485 template<
typename _Pair>
486 struct _Select1st :
public unary_function<_Pair,
487 typename _Pair::first_type>
489 typename _Pair::first_type&
490 operator()(_Pair& __x)
const
491 {
return __x.first; }
493 const typename _Pair::first_type&
494 operator()(
const _Pair& __x)
const
495 {
return __x.first; }
497 #ifdef __GXX_EXPERIMENTAL_CXX0X__
498 template<
typename _Pair2>
499 typename _Pair2::first_type&
500 operator()(_Pair2& __x)
const
501 {
return __x.first; }
503 template<
typename _Pair2>
504 const typename _Pair2::first_type&
505 operator()(
const _Pair2& __x)
const
506 {
return __x.first; }
510 template<
typename _Pair>
511 struct _Select2nd :
public unary_function<_Pair,
512 typename _Pair::second_type>
514 typename _Pair::second_type&
515 operator()(_Pair& __x)
const
516 {
return __x.second; }
518 const typename _Pair::second_type&
519 operator()(
const _Pair& __x)
const
520 {
return __x.second; }
541 template<
typename _Ret,
typename _Tp>
550 operator()(_Tp* __p)
const
551 {
return (__p->*_M_f)(); }
559 template<
typename _Ret,
typename _Tp>
568 operator()(
const _Tp* __p)
const
569 {
return (__p->*_M_f)(); }
572 _Ret (_Tp::*_M_f)()
const;
577 template<
typename _Ret,
typename _Tp>
586 operator()(_Tp& __r)
const
587 {
return (__r.*_M_f)(); }
595 template<
typename _Ret,
typename _Tp>
604 operator()(
const _Tp& __r)
const
605 {
return (__r.*_M_f)(); }
608 _Ret (_Tp::*_M_f)()
const;
613 template<
typename _Ret,
typename _Tp,
typename _Arg>
622 operator()(_Tp* __p, _Arg __x)
const
623 {
return (__p->*_M_f)(__x); }
626 _Ret (_Tp::*_M_f)(_Arg);
631 template<
typename _Ret,
typename _Tp,
typename _Arg>
640 operator()(
const _Tp* __p, _Arg __x)
const
641 {
return (__p->*_M_f)(__x); }
644 _Ret (_Tp::*_M_f)(_Arg)
const;
649 template<
typename _Ret,
typename _Tp,
typename _Arg>
658 operator()(_Tp& __r, _Arg __x)
const
659 {
return (__r.*_M_f)(__x); }
662 _Ret (_Tp::*_M_f)(_Arg);
667 template<
typename _Ret,
typename _Tp,
typename _Arg>
676 operator()(
const _Tp& __r, _Arg __x)
const
677 {
return (__r.*_M_f)(__x); }
680 _Ret (_Tp::*_M_f)(_Arg)
const;
685 template<
typename _Ret,
typename _Tp>
687 mem_fun(_Ret (_Tp::*__f)())
690 template<
typename _Ret,
typename _Tp>
691 inline const_mem_fun_t<_Ret, _Tp>
692 mem_fun(_Ret (_Tp::*__f)()
const)
693 {
return const_mem_fun_t<_Ret, _Tp>(__f); }
695 template<
typename _Ret,
typename _Tp>
696 inline mem_fun_ref_t<_Ret, _Tp>
697 mem_fun_ref(_Ret (_Tp::*__f)())
698 {
return mem_fun_ref_t<_Ret, _Tp>(__f); }
700 template<
typename _Ret,
typename _Tp>
701 inline const_mem_fun_ref_t<_Ret, _Tp>
702 mem_fun_ref(_Ret (_Tp::*__f)()
const)
703 {
return const_mem_fun_ref_t<_Ret, _Tp>(__f); }
705 template<
typename _Ret,
typename _Tp,
typename _Arg>
706 inline mem_fun1_t<_Ret, _Tp, _Arg>
707 mem_fun(_Ret (_Tp::*__f)(_Arg))
708 {
return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
710 template<
typename _Ret,
typename _Tp,
typename _Arg>
711 inline const_mem_fun1_t<_Ret, _Tp, _Arg>
712 mem_fun(_Ret (_Tp::*__f)(_Arg)
const)
713 {
return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
715 template<
typename _Ret,
typename _Tp,
typename _Arg>
716 inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
717 mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
718 {
return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
720 template<
typename _Ret,
typename _Tp,
typename _Arg>
721 inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
722 mem_fun_ref(_Ret (_Tp::*__f)(_Arg)
const)
723 {
return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
727 _GLIBCXX_END_NAMESPACE_VERSION
730 #if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED