63 template <
class _Arg,
class _Result>
66 typedef _Arg argument_type;
67 typedef _Result result_type;
70 template <
class _Arg1,
class _Arg2,
class _Result>
71 struct binary_function
73 typedef _Arg1 first_argument_type;
74 typedef _Arg2 second_argument_type;
75 typedef _Result result_type;
80 struct plus :
public binary_function<_Tp, _Tp, _Tp>
82 _Tp operator () (
const _Tp& __x,
const _Tp& __y)
const noexcept
90 struct minus :
public binary_function<_Tp, _Tp, _Tp>
92 _Tp operator () (
const _Tp& __x,
const _Tp& __y)
const noexcept
100 struct multiplies :
public binary_function<_Tp, _Tp, _Tp>
102 _Tp operator () (
const _Tp& __x,
const _Tp& __y)
const noexcept
110 struct divides :
public binary_function<_Tp, _Tp, _Tp>
112 _Tp operator () (
const _Tp& __x,
const _Tp& __y)
const noexcept
120 struct modulus :
public binary_function<_Tp, _Tp, _Tp>
122 _Tp operator () (
const _Tp& __x,
const _Tp& __y)
const noexcept
130 struct negate :
public unary_function<_Tp, _Tp>
132 _Tp operator () (
const _Tp& __x)
const noexcept
140 struct equal_to :
public binary_function<_Tp, _Tp, bool>
142 bool operator () (
const _Tp& __x,
const _Tp& __y)
const noexcept
150 struct not_equal_to :
public binary_function<_Tp, _Tp, bool>
152 bool operator()(
const _Tp& __x,
const _Tp& __y)
const noexcept
160 struct greater :
public binary_function<_Tp, _Tp, bool>
162 bool operator () (
const _Tp& __x,
const _Tp& __y)
const noexcept
170 struct less :
public binary_function<_Tp, _Tp, bool>
172 bool operator () (
const _Tp& __x,
const _Tp& __y)
const noexcept
180 struct greater_equal :
public binary_function<_Tp, _Tp, bool>
182 bool operator () (
const _Tp& __x,
const _Tp& __y)
const noexcept
190 struct less_equal :
public binary_function<_Tp, _Tp, bool>
192 bool operator () (
const _Tp& __x,
const _Tp& __y)
const noexcept
200 struct logical_and :
public binary_function<_Tp, _Tp, bool>
202 bool operator () (
const _Tp& __x,
const _Tp& __y)
const noexcept
210 struct logical_or :
public binary_function<_Tp, _Tp, bool>
212 bool operator () (
const _Tp& __x,
const _Tp& __y)
const noexcept
220 struct logical_not :
public unary_function<_Tp, bool>
222 bool operator () (
const _Tp& __x)
const noexcept
229 template <
class _Predicate>
231 :
public unary_function <typename _Predicate::argument_type, bool>
239 explicit unary_negate (
const _Predicate& __x) : _M_pred(__x) {}
241 bool operator () (
const typename _Predicate::argument_type& __x)
244 return not _M_pred(__x);
249 template <
class _Predicate>
inline 250 unary_negate<_Predicate> not1 (
const _Predicate& __pred)
252 return unary_negate<_Predicate>(__pred);
256 template <
class _Predicate>
258 :
public binary_function<typename _Predicate::first_argument_type,
259 typename _Predicate::second_argument_type,
268 explicit binary_negate (
const _Predicate& __x) : _M_pred(__x) { }
271 operator () (
const typename _Predicate::first_argument_type& __x,
272 const typename _Predicate::second_argument_type& __y)
const 274 return not _M_pred(__x, __y);
279 template <
class _Predicate>
inline 280 binary_negate<_Predicate> not2 (
const _Predicate& __pred)
282 return binary_negate<_Predicate>(__pred);
286 template <
class _Operation>
288 :
public unary_function<typename _Operation::second_argument_type,
289 typename _Operation::result_type>
295 typename _Operation::first_argument_type value;
299 binder1st(
const _Operation& __x,
300 const typename _Operation::first_argument_type& __y)
301 : op(__x), value(__y) {}
303 typename _Operation::result_type
304 operator () (
const typename _Operation::second_argument_type& __x)
const 306 return op (value, __x);
309 typename _Operation::result_type
310 operator () (
typename _Operation::second_argument_type& __x)
const 312 return op(value, __x);
317 template <
class _Operation,
class _Tp>
inline 318 binder1st<_Operation> bind1st(
const _Operation& __fn,
const _Tp& __x)
320 typedef typename _Operation::first_argument_type _Arg1_type;
322 return binder1st<_Operation> (__fn, _Arg1_type(__x));
325 template <
class _Operation>
327 :
public unary_function<typename _Operation::first_argument_type,
328 typename _Operation::result_type>
334 typename _Operation::second_argument_type value;
338 binder2nd(
const _Operation& __x,
339 const typename _Operation::second_argument_type& __y)
340 : op(__x), value (__y) {}
342 typename _Operation::result_type
343 operator () (
const typename _Operation::first_argument_type& __x)
const 345 return op (__x, value);
348 typename _Operation::result_type
349 operator () (
typename _Operation::first_argument_type& __x)
const 351 return op (__x, value);
356 template <
class _Operation,
class _Tp>
inline 357 binder2nd<_Operation> bind2nd (
const _Operation& __fn,
const _Tp& __x)
359 typedef typename _Operation::second_argument_type _Arg2_type;
361 return binder2nd<_Operation>(__fn, _Arg2_type(__x));
365 template <
class _Arg,
class _Result>
366 class pointer_to_unary_function :
public unary_function<_Arg, _Result>
370 _Result (*_M_ptr) (_Arg);
374 pointer_to_unary_function () {}
376 explicit pointer_to_unary_function(_Result (*__x) (_Arg))
379 _Result operator () (_Arg __x)
const 386 template <
class _Arg,
class _Result>
inline 387 pointer_to_unary_function<_Arg, _Result> ptr_fun(_Result (*__x)(_Arg))
389 return pointer_to_unary_function<_Arg, _Result>(__x);
393 template <
class _Arg1,
class _Arg2,
class _Result>
394 class pointer_to_binary_function
395 :
public binary_function<_Arg1, _Arg2, _Result>
399 _Result (*_M_ptr) (_Arg1, _Arg2);
403 pointer_to_binary_function() {}
405 explicit pointer_to_binary_function(_Result (*__x) (_Arg1, _Arg2))
408 _Result operator () (_Arg1 __x, _Arg2 __y)
const 410 return _M_ptr(__x, __y);
415 template <
class _Arg1,
class _Arg2,
class _Result>
inline 416 pointer_to_binary_function<_Arg1, _Arg2, _Result>
417 ptr_fun (_Result (*__x) (_Arg1, _Arg2) )
419 return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x);
423 struct _Identity :
public unary_function<_Tp,_Tp>
425 _Tp & operator () (_Tp& __x)
const 430 const _Tp& operator () (
const _Tp& __x)
const 436 template <
class _Pair>
437 struct _Select1st :
public unary_function<_Pair, typename _Pair::first_type>
439 typename _Pair::first_type& operator () (_Pair& __x)
const 444 const typename _Pair::first_type& operator () (
const _Pair& __x)
const 450 template <
class _Pair>
451 struct _Select2nd :
public unary_function<_Pair, typename _Pair::second_type>
453 typename _Pair::second_type& operator () (_Pair& __x)
const 458 const typename _Pair::second_type& operator () (
const _Pair& __x)
const 465 template <
class _Ret,
class _Tp>
466 class mem_fun_t :
public unary_function<_Tp*, _Ret>
470 explicit mem_fun_t (_Ret (_Tp::*__pf) () )
473 _Ret operator ()(_Tp* __p)
const 475 return (__p->*_M_f)();
480 _Ret (_Tp::*_M_f) ();
484 template <
class _Ret,
class _Tp>
485 class const_mem_fun_t :
public unary_function<const _Tp*, _Ret>
489 explicit const_mem_fun_t (_Ret (_Tp::*__pf) ()
const)
492 _Ret operator () (
const _Tp* __p)
const 494 return (__p->*_M_f) ();
499 _Ret (_Tp::*_M_f) ()
const;
503 template <
class _Ret,
class _Tp>
504 class mem_fun_ref_t :
public unary_function<_Tp, _Ret>
508 explicit mem_fun_ref_t (_Ret (_Tp::*__pf)())
511 _Ret operator () (_Tp& __r)
const 513 return (__r.*_M_f)();
518 _Ret (_Tp::*_M_f) ();
522 template <
class _Ret,
class _Tp>
523 class const_mem_fun_ref_t :
public unary_function<_Tp, _Ret>
527 explicit const_mem_fun_ref_t (_Ret (_Tp::*__pf)()
const)
530 _Ret operator () (
const _Tp& __r)
const 532 return (__r.*_M_f)();
537 _Ret (_Tp::*_M_f) ()
const;
541 template <
class _Ret,
class _Tp,
class _Arg>
542 class mem_fun1_t :
public binary_function<_Tp*, _Arg, _Ret>
546 explicit mem_fun1_t (_Ret (_Tp::*__pf) (_Arg))
549 _Ret operator () (_Tp* __p, _Arg __x)
const 551 return (__p->*_M_f) (__x);
556 _Ret (_Tp::*_M_f) (_Arg);
560 template <
class _Ret,
class _Tp,
class _Arg>
561 class const_mem_fun1_t :
public binary_function<const _Tp*, _Arg, _Ret>
565 explicit const_mem_fun1_t (_Ret (_Tp::*__pf) (_Arg)
const)
568 _Ret operator () (
const _Tp* __p, _Arg __x)
const 570 return (__p->*_M_f)(__x);
575 _Ret (_Tp::*_M_f) (_Arg)
const;
579 template <
class _Ret,
class _Tp,
class _Arg>
580 class mem_fun1_ref_t :
public binary_function<_Tp, _Arg, _Ret>
584 explicit mem_fun1_ref_t (_Ret (_Tp::*__pf) (_Arg))
587 _Ret operator () (_Tp& __r, _Arg __x)
const 589 return (__r.*_M_f)(__x);
594 _Ret (_Tp::*_M_f) (_Arg);
598 template <
class _Ret,
class _Tp,
class _Arg>
599 class const_mem_fun1_ref_t :
public binary_function<_Tp, _Arg, _Ret>
603 explicit const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg)
const)
606 _Ret operator () (
const _Tp& __r, _Arg __x)
const 608 return (__r.*_M_f)(__x);
613 _Ret (_Tp::*_M_f) (_Arg)
const;
618 class mem_fun_t<void, _Tp> :
public unary_function<_Tp*, void>
622 explicit mem_fun_t (
void (_Tp::*__pf)())
625 void operator () (_Tp* __p)
const 637 class const_mem_fun_t<void, _Tp> :
public unary_function<const _Tp*, void>
641 explicit const_mem_fun_t (
void (_Tp::*__pf)()
const)
644 void operator () (
const _Tp* __p)
const 651 void (_Tp::*_M_f)()
const;
656 class mem_fun_ref_t<void, _Tp> :
public unary_function<_Tp, void>
660 explicit mem_fun_ref_t (
void (_Tp::*__pf)()) : _M_f (__pf) {}
662 void operator () (_Tp& __r)
const 674 class const_mem_fun_ref_t<void, _Tp> :
public unary_function<_Tp, void>
678 explicit const_mem_fun_ref_t (
void (_Tp::*__pf) ()
const)
681 void operator () (
const _Tp& __r)
const 688 void (_Tp::*_M_f) ()
const;
692 template <
class _Tp,
class _Arg>
693 class mem_fun1_t<void, _Tp, _Arg> :
public binary_function<_Tp*, _Arg, void>
697 explicit mem_fun1_t(
void (_Tp::*__pf) (_Arg)) : _M_f (__pf) {}
699 void operator () (_Tp* __p, _Arg __x)
const 706 void (_Tp::*_M_f) (_Arg);
710 template <
class _Tp,
class _Arg>
711 class const_mem_fun1_t<void, _Tp, _Arg>
712 :
public binary_function<const _Tp*, _Arg, void>
716 explicit const_mem_fun1_t (
void (_Tp::*__pf) (_Arg)
const) : _M_f (__pf) {}
718 void operator () (
const _Tp* __p, _Arg __x)
const 725 void (_Tp::*_M_f)(_Arg)
const;
729 template <
class _Tp,
class _Arg>
730 class mem_fun1_ref_t<void, _Tp, _Arg>
731 :
public binary_function<_Tp, _Arg, void>
735 explicit mem_fun1_ref_t (
void (_Tp::*__pf) (_Arg)) : _M_f (__pf) {}
737 void operator () (_Tp& __r, _Arg __x)
const 744 void (_Tp::*_M_f) (_Arg);
748 template <
class _Tp,
class _Arg>
749 class const_mem_fun1_ref_t<void, _Tp, _Arg>
750 :
public binary_function<_Tp, _Arg, void>
754 explicit const_mem_fun1_ref_t (
void (_Tp::*__pf) (_Arg)
const)
757 void operator () (
const _Tp& __r, _Arg __x)
const 764 void (_Tp::*_M_f)(_Arg)
const;
768 template <
class _Ret,
class _Tp>
inline 769 mem_fun_t<_Ret, _Tp> mem_fun (_Ret (_Tp::*__f) () )
771 return mem_fun_t<_Ret, _Tp> (__f);
774 template <
class _Ret,
class _Tp>
inline 775 const_mem_fun_t<_Ret, _Tp> mem_fun (_Ret (_Tp::*__f) ()
const)
777 return const_mem_fun_t<_Ret, _Tp> (__f);
780 template <
class _Ret,
class _Tp>
inline 781 mem_fun_ref_t<_Ret, _Tp> mem_fun_ref (_Ret (_Tp::*__f) ())
783 return mem_fun_ref_t<_Ret, _Tp> (__f);
786 template <
class _Ret,
class _Tp>
inline 787 const_mem_fun_ref_t<_Ret, _Tp> mem_fun_ref (_Ret (_Tp::*__f) ()
const)
789 return const_mem_fun_ref_t<_Ret, _Tp> (__f);
792 template <
class _Ret,
class _Tp,
class _Arg>
inline 793 mem_fun1_t<_Ret, _Tp, _Arg> mem_fun (_Ret (_Tp::*__f) (_Arg))
795 return mem_fun1_t<_Ret, _Tp, _Arg> (__f);
798 template <
class _Ret,
class _Tp,
class _Arg>
inline 799 const_mem_fun1_t<_Ret, _Tp, _Arg> mem_fun (_Ret (_Tp::*__f) (_Arg)
const)
801 return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f);
804 template <
class _Ret,
class _Tp,
class _Arg>
inline 805 mem_fun1_ref_t<_Ret, _Tp, _Arg> mem_fun_ref (_Ret (_Tp::*__f) (_Arg))
807 return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f);
810 template <
class _Ret,
class _Tp,
class _Arg>
inline 811 const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
812 mem_fun_ref (_Ret (_Tp::*__f) (_Arg)
const)
814 return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f);
824 template <
class T,
class Compare>
inline 825 bool less_than(
const T & op1,
const T & op2, Compare & cmp)
827 return cmp (op1, op2);
835 template <
class T,
class Compare>
inline 836 bool less_than(
const T & op1,
const T & op2, Compare && cmp = Compare())
838 return less_than <T, Compare> (op1, op2, cmp);
848 template <
class T,
class Compare>
inline 849 bool less_or_equal_than(
const T& op1,
const T& op2, Compare & cmp)
865 template <
class T,
class Compare>
inline 866 bool less_or_equal_than(
const T& op1,
const T& op2, Compare && cmp = Compare())
868 return less_or_equal_than<T, Compare>(op1, op2, cmp);
878 template <
class T,
class Compare>
inline 879 bool greater_than(
const T& op1,
const T& op2, Compare && cmp = Compare())
881 return not less_or_equal_than<T, Compare>(op1, op2,
882 std::forward<Compare>(cmp));
889 template <
class T,
class Compare>
inline 890 bool greater_than(
const T& op1,
const T& op2, Compare & cmp)
892 return not less_or_equal_than<T, Compare> (op1, op2, cmp);
901 template <
class T,
class Compare>
inline 902 bool greater_or_equal_than(
const T& op1,
const T & op2,
903 Compare && cmp = Compare())
905 return not less_than<T, Compare> (op1, op2, std::forward<Compare>(cmp));
912 template <
class T,
class Compare>
inline 913 bool greater_or_equal_than(
const T& op1,
const T& op2, Compare & cmp)
915 return not less_than<T, Compare> (op1, op2, cmp);
924 template <
class T,
class Compare>
inline 925 bool no_equals(
const T & op1,
const T & op2, Compare && cmp = Compare())
927 return cmp(op1, op2) or cmp(op2, op1);
934 template <
class T,
class Compare>
inline 935 bool no_equals(
const T & op1,
const T & op2, Compare & cmp)
937 return cmp(op1, op2) or cmp(op2, op1);
946 template <
class T,
class Compare>
inline 947 bool are_equals(
const T & op1,
const T & op2, Compare && cmp = Compare())
949 return not no_equals <T, Compare> (op1, op2, std::forward<Compare>(cmp));
956 template <
class T,
class Compare>
inline 957 bool are_equals(
const T & op1,
const T & op2, Compare & cmp)
959 return not no_equals <T, Compare> (op1, op2, cmp);
968 template <
class T,
class Compare>
981 bool operator () (
const T & op1,
const T & op2)
const noexcept
983 return cmp(op2, op1);
991 template <
class T,
class Compare>
994 bool operator () (
const T & op1,
const T & op2)
const 996 if (Compare () (op1, op2))
999 if (Compare () (op2, op1))
Definition: ahFunction.H:969