57 #ifndef _STL_FUNCTION_H
58 #define _STL_FUNCTION_H 1
60 _GLIBCXX_BEGIN_NAMESPACE(std)
99 template<typename _Arg, typename _Result>
111 template<
typename _Arg1,
typename _Arg2,
typename _Result>
134 template<
typename _Tp>
138 operator()(
const _Tp& __x,
const _Tp& __y)
const
139 {
return __x + __y; }
143 template<
typename _Tp>
147 operator()(
const _Tp& __x,
const _Tp& __y)
const
148 {
return __x - __y; }
152 template<
typename _Tp>
156 operator()(
const _Tp& __x,
const _Tp& __y)
const
157 {
return __x * __y; }
161 template<
typename _Tp>
165 operator()(
const _Tp& __x,
const _Tp& __y)
const
166 {
return __x / __y; }
170 template<
typename _Tp>
174 operator()(
const _Tp& __x,
const _Tp& __y)
const
175 {
return __x % __y; }
179 template<
typename _Tp>
183 operator()(
const _Tp& __x)
const
198 template<
typename _Tp>
202 operator()(
const _Tp& __x,
const _Tp& __y)
const
203 {
return __x == __y; }
207 template<
typename _Tp>
211 operator()(
const _Tp& __x,
const _Tp& __y)
const
212 {
return __x != __y; }
216 template<
typename _Tp>
220 operator()(
const _Tp& __x,
const _Tp& __y)
const
221 {
return __x > __y; }
225 template<
typename _Tp>
229 operator()(
const _Tp& __x,
const _Tp& __y)
const
230 {
return __x < __y; }
234 template<
typename _Tp>
238 operator()(
const _Tp& __x,
const _Tp& __y)
const
239 {
return __x >= __y; }
243 template<
typename _Tp>
247 operator()(
const _Tp& __x,
const _Tp& __y)
const
248 {
return __x <= __y; }
262 template<
typename _Tp>
266 operator()(
const _Tp& __x,
const _Tp& __y)
const
267 {
return __x && __y; }
271 template<
typename _Tp>
275 operator()(
const _Tp& __x,
const _Tp& __y)
const
276 {
return __x || __y; }
280 template<
typename _Tp>
284 operator()(
const _Tp& __x)
const
291 template<
typename _Tp>
295 operator()(
const _Tp& __x,
const _Tp& __y)
const
296 {
return __x & __y; }
299 template<
typename _Tp>
300 struct bit_or :
public binary_function<_Tp, _Tp, _Tp>
303 operator()(
const _Tp& __x,
const _Tp& __y)
const
304 {
return __x | __y; }
307 template<
typename _Tp>
308 struct bit_xor :
public binary_function<_Tp, _Tp, _Tp>
311 operator()(
const _Tp& __x,
const _Tp& __y)
const
312 {
return __x ^ __y; }
345 template<
typename _Predicate>
357 operator()(
const typename _Predicate::argument_type& __x)
const
358 {
return !_M_pred(__x); }
362 template<
typename _Predicate>
368 template<
typename _Predicate>
371 typename _Predicate::second_argument_type, bool>
381 operator()(
const typename _Predicate::first_argument_type& __x,
382 const typename _Predicate::second_argument_type& __y)
const
383 {
return !_M_pred(__x, __y); }
387 template<
typename _Predicate>
416 template<
typename _Arg,
typename _Result>
420 _Result (*_M_ptr)(_Arg);
430 operator()(_Arg __x)
const
431 {
return _M_ptr(__x); }
435 template<
typename _Arg,
typename _Result>
441 template<
typename _Arg1,
typename _Arg2,
typename _Result>
446 _Result (*_M_ptr)(_Arg1, _Arg2);
456 operator()(_Arg1 __x, _Arg2 __y)
const
457 {
return _M_ptr(__x, __y); }
461 template<
typename _Arg1,
typename _Arg2,
typename _Result>
467 template<
typename _Tp>
468 struct _Identity :
public unary_function<_Tp,_Tp>
471 operator()(_Tp& __x)
const
475 operator()(
const _Tp& __x)
const
479 template<
typename _Pair>
480 struct _Select1st :
public unary_function<_Pair,
481 typename _Pair::first_type>
483 typename _Pair::first_type&
484 operator()(_Pair& __x)
const
485 {
return __x.first; }
487 const typename _Pair::first_type&
488 operator()(
const _Pair& __x)
const
489 {
return __x.first; }
492 template<
typename _Pair>
493 struct _Select2nd :
public unary_function<_Pair,
494 typename _Pair::second_type>
496 typename _Pair::second_type&
497 operator()(_Pair& __x)
const
498 {
return __x.second; }
500 const typename _Pair::second_type&
501 operator()(
const _Pair& __x)
const
502 {
return __x.second; }
523 template<
typename _Ret,
typename _Tp>
532 operator()(_Tp* __p)
const
533 {
return (__p->*_M_f)(); }
541 template<
typename _Ret,
typename _Tp>
550 operator()(
const _Tp* __p)
const
551 {
return (__p->*_M_f)(); }
554 _Ret (_Tp::*_M_f)()
const;
559 template<
typename _Ret,
typename _Tp>
568 operator()(_Tp& __r)
const
569 {
return (__r.*_M_f)(); }
577 template<
typename _Ret,
typename _Tp>
586 operator()(
const _Tp& __r)
const
587 {
return (__r.*_M_f)(); }
590 _Ret (_Tp::*_M_f)()
const;
595 template<
typename _Ret,
typename _Tp,
typename _Arg>
604 operator()(_Tp* __p, _Arg __x)
const
605 {
return (__p->*_M_f)(__x); }
608 _Ret (_Tp::*_M_f)(_Arg);
613 template<
typename _Ret,
typename _Tp,
typename _Arg>
622 operator()(
const _Tp* __p, _Arg __x)
const
623 {
return (__p->*_M_f)(__x); }
626 _Ret (_Tp::*_M_f)(_Arg)
const;
631 template<
typename _Ret,
typename _Tp,
typename _Arg>
640 operator()(_Tp& __r, _Arg __x)
const
641 {
return (__r.*_M_f)(__x); }
644 _Ret (_Tp::*_M_f)(_Arg);
649 template<
typename _Ret,
typename _Tp,
typename _Arg>
658 operator()(
const _Tp& __r, _Arg __x)
const
659 {
return (__r.*_M_f)(__x); }
662 _Ret (_Tp::*_M_f)(_Arg)
const;
667 template<
typename _Ret,
typename _Tp>
669 mem_fun(_Ret (_Tp::*__f)())
672 template<
typename _Ret,
typename _Tp>
673 inline const_mem_fun_t<_Ret, _Tp>
674 mem_fun(_Ret (_Tp::*__f)()
const)
675 {
return const_mem_fun_t<_Ret, _Tp>(__f); }
677 template<
typename _Ret,
typename _Tp>
678 inline mem_fun_ref_t<_Ret, _Tp>
679 mem_fun_ref(_Ret (_Tp::*__f)())
680 {
return mem_fun_ref_t<_Ret, _Tp>(__f); }
682 template<
typename _Ret,
typename _Tp>
683 inline const_mem_fun_ref_t<_Ret, _Tp>
684 mem_fun_ref(_Ret (_Tp::*__f)()
const)
685 {
return const_mem_fun_ref_t<_Ret, _Tp>(__f); }
687 template<
typename _Ret,
typename _Tp,
typename _Arg>
688 inline mem_fun1_t<_Ret, _Tp, _Arg>
689 mem_fun(_Ret (_Tp::*__f)(_Arg))
690 {
return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
692 template<
typename _Ret,
typename _Tp,
typename _Arg>
693 inline const_mem_fun1_t<_Ret, _Tp, _Arg>
694 mem_fun(_Ret (_Tp::*__f)(_Arg)
const)
695 {
return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
697 template<
typename _Ret,
typename _Tp,
typename _Arg>
698 inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
699 mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
700 {
return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
702 template<
typename _Ret,
typename _Tp,
typename _Arg>
703 inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
704 mem_fun_ref(_Ret (_Tp::*__f)(_Arg)
const)
705 {
return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
709 _GLIBCXX_END_NAMESPACE
711 #if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_DEPRECATED