58 #ifndef _STL_FUNCTION_H
59 #define _STL_FUNCTION_H 1
61 namespace std _GLIBCXX_VISIBILITY(default)
63 _GLIBCXX_BEGIN_NAMESPACE_VERSION
102 template<
typename _Arg,
typename _Result>
115 template<
typename _Arg1,
typename _Arg2,
typename _Result>
141 template<
typename _Tp>
145 operator()(
const _Tp& __x,
const _Tp& __y)
const
146 {
return __x + __y; }
150 template<
typename _Tp>
154 operator()(
const _Tp& __x,
const _Tp& __y)
const
155 {
return __x - __y; }
159 template<
typename _Tp>
163 operator()(
const _Tp& __x,
const _Tp& __y)
const
164 {
return __x * __y; }
168 template<
typename _Tp>
172 operator()(
const _Tp& __x,
const _Tp& __y)
const
173 {
return __x / __y; }
177 template<
typename _Tp>
181 operator()(
const _Tp& __x,
const _Tp& __y)
const
182 {
return __x % __y; }
186 template<
typename _Tp>
190 operator()(
const _Tp& __x)
const
205 template<
typename _Tp>
209 operator()(
const _Tp& __x,
const _Tp& __y)
const
210 {
return __x == __y; }
214 template<
typename _Tp>
218 operator()(
const _Tp& __x,
const _Tp& __y)
const
219 {
return __x != __y; }
223 template<
typename _Tp>
227 operator()(
const _Tp& __x,
const _Tp& __y)
const
228 {
return __x > __y; }
232 template<
typename _Tp>
236 operator()(
const _Tp& __x,
const _Tp& __y)
const
237 {
return __x < __y; }
241 template<
typename _Tp>
245 operator()(
const _Tp& __x,
const _Tp& __y)
const
246 {
return __x >= __y; }
250 template<
typename _Tp>
254 operator()(
const _Tp& __x,
const _Tp& __y)
const
255 {
return __x <= __y; }
269 template<
typename _Tp>
273 operator()(
const _Tp& __x,
const _Tp& __y)
const
274 {
return __x && __y; }
278 template<
typename _Tp>
282 operator()(
const _Tp& __x,
const _Tp& __y)
const
283 {
return __x || __y; }
287 template<
typename _Tp>
291 operator()(
const _Tp& __x)
const
298 template<
typename _Tp>
302 operator()(
const _Tp& __x,
const _Tp& __y)
const
303 {
return __x & __y; }
306 template<
typename _Tp>
307 struct bit_or :
public binary_function<_Tp, _Tp, _Tp>
310 operator()(
const _Tp& __x,
const _Tp& __y)
const
311 {
return __x | __y; }
314 template<
typename _Tp>
315 struct bit_xor :
public binary_function<_Tp, _Tp, _Tp>
318 operator()(
const _Tp& __x,
const _Tp& __y)
const
319 {
return __x ^ __y; }
352 template<
typename _Predicate>
364 operator()(
const typename _Predicate::argument_type& __x)
const
365 {
return !_M_pred(__x); }
369 template<
typename _Predicate>
375 template<
typename _Predicate>
378 typename _Predicate::second_argument_type, bool>
388 operator()(
const typename _Predicate::first_argument_type& __x,
389 const typename _Predicate::second_argument_type& __y)
const
390 {
return !_M_pred(__x, __y); }
394 template<
typename _Predicate>
423 template<
typename _Arg,
typename _Result>
427 _Result (*_M_ptr)(_Arg);
437 operator()(_Arg __x)
const
438 {
return _M_ptr(__x); }
442 template<
typename _Arg,
typename _Result>
448 template<
typename _Arg1,
typename _Arg2,
typename _Result>
453 _Result (*_M_ptr)(_Arg1, _Arg2);
463 operator()(_Arg1 __x, _Arg2 __y)
const
464 {
return _M_ptr(__x, __y); }
468 template<
typename _Arg1,
typename _Arg2,
typename _Result>
474 template<
typename _Tp>
476 #ifndef __GXX_EXPERIMENTAL_CXX0X__
479 :
public unary_function<_Tp,_Tp>
483 operator()(_Tp& __x)
const
487 operator()(
const _Tp& __x)
const
491 template<
typename _Pair>
493 #ifndef __GXX_EXPERIMENTAL_CXX0X__
494 :
public unary_function<_Pair, typename _Pair::first_type>
497 typename _Pair::first_type&
498 operator()(_Pair& __x)
const
499 {
return __x.first; }
501 const typename _Pair::first_type&
502 operator()(
const _Pair& __x)
const
503 {
return __x.first; }
505 #ifdef __GXX_EXPERIMENTAL_CXX0X__
506 template<
typename _Pair2>
507 typename _Pair2::first_type&
508 operator()(_Pair2& __x)
const
509 {
return __x.first; }
511 template<
typename _Pair2>
512 const typename _Pair2::first_type&
513 operator()(
const _Pair2& __x)
const
514 {
return __x.first; }
518 template<
typename _Pair>
520 #ifndef __GXX_EXPERIMENTAL_CXX0X__
521 :
public unary_function<_Pair, typename _Pair::second_type>
524 typename _Pair::second_type&
525 operator()(_Pair& __x)
const
526 {
return __x.second; }
528 const typename _Pair::second_type&
529 operator()(
const _Pair& __x)
const
530 {
return __x.second; }
551 template<
typename _Ret,
typename _Tp>
560 operator()(_Tp* __p)
const
561 {
return (__p->*_M_f)(); }
569 template<
typename _Ret,
typename _Tp>
578 operator()(
const _Tp* __p)
const
579 {
return (__p->*_M_f)(); }
582 _Ret (_Tp::*_M_f)()
const;
587 template<
typename _Ret,
typename _Tp>
596 operator()(_Tp& __r)
const
597 {
return (__r.*_M_f)(); }
605 template<
typename _Ret,
typename _Tp>
614 operator()(
const _Tp& __r)
const
615 {
return (__r.*_M_f)(); }
618 _Ret (_Tp::*_M_f)()
const;
623 template<
typename _Ret,
typename _Tp,
typename _Arg>
632 operator()(_Tp* __p, _Arg __x)
const
633 {
return (__p->*_M_f)(__x); }
636 _Ret (_Tp::*_M_f)(_Arg);
641 template<
typename _Ret,
typename _Tp,
typename _Arg>
650 operator()(
const _Tp* __p, _Arg __x)
const
651 {
return (__p->*_M_f)(__x); }
654 _Ret (_Tp::*_M_f)(_Arg)
const;
659 template<
typename _Ret,
typename _Tp,
typename _Arg>
668 operator()(_Tp& __r, _Arg __x)
const
669 {
return (__r.*_M_f)(__x); }
672 _Ret (_Tp::*_M_f)(_Arg);
677 template<
typename _Ret,
typename _Tp,
typename _Arg>
686 operator()(
const _Tp& __r, _Arg __x)
const
687 {
return (__r.*_M_f)(__x); }
690 _Ret (_Tp::*_M_f)(_Arg)
const;
695 template<
typename _Ret,
typename _Tp>
697 mem_fun(_Ret (_Tp::*__f)())
700 template<
typename _Ret,
typename _Tp>
701 inline const_mem_fun_t<_Ret, _Tp>
702 mem_fun(_Ret (_Tp::*__f)()
const)
703 {
return const_mem_fun_t<_Ret, _Tp>(__f); }
705 template<
typename _Ret,
typename _Tp>
706 inline mem_fun_ref_t<_Ret, _Tp>
707 mem_fun_ref(_Ret (_Tp::*__f)())
708 {
return mem_fun_ref_t<_Ret, _Tp>(__f); }
710 template<
typename _Ret,
typename _Tp>
711 inline const_mem_fun_ref_t<_Ret, _Tp>
712 mem_fun_ref(_Ret (_Tp::*__f)()
const)
713 {
return const_mem_fun_ref_t<_Ret, _Tp>(__f); }
715 template<
typename _Ret,
typename _Tp,
typename _Arg>
716 inline mem_fun1_t<_Ret, _Tp, _Arg>
717 mem_fun(_Ret (_Tp::*__f)(_Arg))
718 {
return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
720 template<
typename _Ret,
typename _Tp,
typename _Arg>
721 inline const_mem_fun1_t<_Ret, _Tp, _Arg>
722 mem_fun(_Ret (_Tp::*__f)(_Arg)
const)
723 {
return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
725 template<
typename _Ret,
typename _Tp,
typename _Arg>
726 inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
727 mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
728 {
return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
730 template<
typename _Ret,
typename _Tp,
typename _Arg>
731 inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
732 mem_fun_ref(_Ret (_Tp::*__f)(_Arg)
const)
733 {
return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
737 _GLIBCXX_END_NAMESPACE_VERSION
740 #if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_USE_DEPRECATED