56 #ifndef _STL_FUNCTION_H 57 #define _STL_FUNCTION_H 1 59 #if __cplusplus > 201103L 63 namespace std _GLIBCXX_VISIBILITY(default)
65 _GLIBCXX_BEGIN_NAMESPACE_VERSION
104 template<
typename _Arg,
typename _Result>
117 template<
typename _Arg1,
typename _Arg2,
typename _Result>
143 #if __cplusplus > 201103L 144 struct __is_transparent;
146 template<
typename _Tp =
void>
149 template<
typename _Tp =
void>
152 template<
typename _Tp =
void>
155 template<
typename _Tp =
void>
158 template<
typename _Tp =
void>
161 template<
typename _Tp =
void>
166 template<
typename _Tp>
171 operator()(
const _Tp& __x,
const _Tp& __y)
const 172 {
return __x + __y; }
176 template<
typename _Tp>
181 operator()(
const _Tp& __x,
const _Tp& __y)
const 182 {
return __x - __y; }
186 template<
typename _Tp>
191 operator()(
const _Tp& __x,
const _Tp& __y)
const 192 {
return __x * __y; }
196 template<
typename _Tp>
201 operator()(
const _Tp& __x,
const _Tp& __y)
const 202 {
return __x / __y; }
206 template<
typename _Tp>
211 operator()(
const _Tp& __x,
const _Tp& __y)
const 212 {
return __x % __y; }
216 template<
typename _Tp>
221 operator()(
const _Tp& __x)
const 225 #if __cplusplus > 201103L 227 #define __cpp_lib_transparent_operators 201510 232 template <
typename _Tp,
typename _Up>
235 operator()(_Tp&& __t, _Up&& __u)
const 236 noexcept(noexcept(std::forward<_Tp>(__t) + std::forward<_Up>(__u)))
237 -> decltype(std::forward<_Tp>(__t) + std::forward<_Up>(__u))
238 {
return std::forward<_Tp>(__t) + std::forward<_Up>(__u); }
240 typedef __is_transparent is_transparent;
247 template <
typename _Tp,
typename _Up>
250 operator()(_Tp&& __t, _Up&& __u)
const 251 noexcept(noexcept(std::forward<_Tp>(__t) - std::forward<_Up>(__u)))
252 -> decltype(std::forward<_Tp>(__t) - std::forward<_Up>(__u))
253 {
return std::forward<_Tp>(__t) - std::forward<_Up>(__u); }
255 typedef __is_transparent is_transparent;
262 template <
typename _Tp,
typename _Up>
265 operator()(_Tp&& __t, _Up&& __u)
const 266 noexcept(noexcept(std::forward<_Tp>(__t) * std::forward<_Up>(__u)))
267 -> decltype(std::forward<_Tp>(__t) * std::forward<_Up>(__u))
268 {
return std::forward<_Tp>(__t) * std::forward<_Up>(__u); }
270 typedef __is_transparent is_transparent;
277 template <
typename _Tp,
typename _Up>
280 operator()(_Tp&& __t, _Up&& __u)
const 281 noexcept(noexcept(std::forward<_Tp>(__t) / std::forward<_Up>(__u)))
282 -> decltype(std::forward<_Tp>(__t) / std::forward<_Up>(__u))
283 {
return std::forward<_Tp>(__t) / std::forward<_Up>(__u); }
285 typedef __is_transparent is_transparent;
292 template <
typename _Tp,
typename _Up>
295 operator()(_Tp&& __t, _Up&& __u)
const 296 noexcept(noexcept(std::forward<_Tp>(__t) % std::forward<_Up>(__u)))
297 -> decltype(std::forward<_Tp>(__t) % std::forward<_Up>(__u))
298 {
return std::forward<_Tp>(__t) % std::forward<_Up>(__u); }
300 typedef __is_transparent is_transparent;
307 template <
typename _Tp>
310 operator()(_Tp&& __t)
const 311 noexcept(noexcept(-std::forward<_Tp>(__t)))
312 -> decltype(-std::forward<_Tp>(__t))
313 {
return -std::forward<_Tp>(__t); }
315 typedef __is_transparent is_transparent;
329 #if __cplusplus > 201103L 330 template<
typename _Tp =
void>
333 template<
typename _Tp =
void>
336 template<
typename _Tp =
void>
339 template<
typename _Tp =
void>
342 template<
typename _Tp =
void>
345 template<
typename _Tp =
void>
350 template<
typename _Tp>
355 operator()(
const _Tp& __x,
const _Tp& __y)
const 356 {
return __x == __y; }
360 template<
typename _Tp>
365 operator()(
const _Tp& __x,
const _Tp& __y)
const 366 {
return __x != __y; }
370 template<
typename _Tp>
375 operator()(
const _Tp& __x,
const _Tp& __y)
const 376 {
return __x > __y; }
380 template<
typename _Tp>
385 operator()(
const _Tp& __x,
const _Tp& __y)
const 386 {
return __x < __y; }
390 template<
typename _Tp>
395 operator()(
const _Tp& __x,
const _Tp& __y)
const 396 {
return __x >= __y; }
400 template<
typename _Tp>
405 operator()(
const _Tp& __x,
const _Tp& __y)
const 406 {
return __x <= __y; }
409 #if __cplusplus > 201103L 414 template <
typename _Tp,
typename _Up>
417 operator()(_Tp&& __t, _Up&& __u)
const 418 noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u)))
419 -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u))
420 {
return std::forward<_Tp>(__t) == std::forward<_Up>(__u); }
422 typedef __is_transparent is_transparent;
429 template <
typename _Tp,
typename _Up>
432 operator()(_Tp&& __t, _Up&& __u)
const 433 noexcept(noexcept(std::forward<_Tp>(__t) != std::forward<_Up>(__u)))
434 -> decltype(std::forward<_Tp>(__t) != std::forward<_Up>(__u))
435 {
return std::forward<_Tp>(__t) != std::forward<_Up>(__u); }
437 typedef __is_transparent is_transparent;
444 template <
typename _Tp,
typename _Up>
447 operator()(_Tp&& __t, _Up&& __u)
const 448 noexcept(noexcept(std::forward<_Tp>(__t) > std::forward<_Up>(__u)))
449 -> decltype(std::forward<_Tp>(__t) > std::forward<_Up>(__u))
450 {
return std::forward<_Tp>(__t) > std::forward<_Up>(__u); }
452 typedef __is_transparent is_transparent;
459 template <
typename _Tp,
typename _Up>
462 operator()(_Tp&& __t, _Up&& __u)
const 463 noexcept(noexcept(std::forward<_Tp>(__t) < std::forward<_Up>(__u)))
464 -> decltype(std::forward<_Tp>(__t) < std::forward<_Up>(__u))
465 {
return std::forward<_Tp>(__t) < std::forward<_Up>(__u); }
467 typedef __is_transparent is_transparent;
474 template <
typename _Tp,
typename _Up>
477 operator()(_Tp&& __t, _Up&& __u)
const 478 noexcept(noexcept(std::forward<_Tp>(__t) >= std::forward<_Up>(__u)))
479 -> decltype(std::forward<_Tp>(__t) >= std::forward<_Up>(__u))
480 {
return std::forward<_Tp>(__t) >= std::forward<_Up>(__u); }
482 typedef __is_transparent is_transparent;
489 template <
typename _Tp,
typename _Up>
492 operator()(_Tp&& __t, _Up&& __u)
const 493 noexcept(noexcept(std::forward<_Tp>(__t) <= std::forward<_Up>(__u)))
494 -> decltype(std::forward<_Tp>(__t) <= std::forward<_Up>(__u))
495 {
return std::forward<_Tp>(__t) <= std::forward<_Up>(__u); }
497 typedef __is_transparent is_transparent;
511 #if __cplusplus > 201103L 512 template<
typename _Tp =
void>
515 template<
typename _Tp =
void>
518 template<
typename _Tp =
void>
523 template<
typename _Tp>
528 operator()(
const _Tp& __x,
const _Tp& __y)
const 529 {
return __x && __y; }
533 template<
typename _Tp>
538 operator()(
const _Tp& __x,
const _Tp& __y)
const 539 {
return __x || __y; }
543 template<
typename _Tp>
548 operator()(
const _Tp& __x)
const 552 #if __cplusplus > 201103L 557 template <
typename _Tp,
typename _Up>
560 operator()(_Tp&& __t, _Up&& __u)
const 561 noexcept(noexcept(std::forward<_Tp>(__t) && std::forward<_Up>(__u)))
562 -> decltype(std::forward<_Tp>(__t) && std::forward<_Up>(__u))
563 {
return std::forward<_Tp>(__t) && std::forward<_Up>(__u); }
565 typedef __is_transparent is_transparent;
572 template <
typename _Tp,
typename _Up>
575 operator()(_Tp&& __t, _Up&& __u)
const 576 noexcept(noexcept(std::forward<_Tp>(__t) || std::forward<_Up>(__u)))
577 -> decltype(std::forward<_Tp>(__t) || std::forward<_Up>(__u))
578 {
return std::forward<_Tp>(__t) || std::forward<_Up>(__u); }
580 typedef __is_transparent is_transparent;
587 template <
typename _Tp>
590 operator()(_Tp&& __t)
const 591 noexcept(noexcept(!std::forward<_Tp>(__t)))
592 -> decltype(!std::forward<_Tp>(__t))
593 {
return !std::forward<_Tp>(__t); }
595 typedef __is_transparent is_transparent;
600 #if __cplusplus > 201103L 601 template<
typename _Tp =
void>
604 template<
typename _Tp =
void>
607 template<
typename _Tp =
void>
610 template<
typename _Tp =
void>
616 template<
typename _Tp>
621 operator()(
const _Tp& __x,
const _Tp& __y)
const 622 {
return __x & __y; }
625 template<
typename _Tp>
630 operator()(
const _Tp& __x,
const _Tp& __y)
const 631 {
return __x | __y; }
634 template<
typename _Tp>
639 operator()(
const _Tp& __x,
const _Tp& __y)
const 640 {
return __x ^ __y; }
643 template<
typename _Tp>
648 operator()(
const _Tp& __x)
const 652 #if __cplusplus > 201103L 656 template <
typename _Tp,
typename _Up>
659 operator()(_Tp&& __t, _Up&& __u)
const 660 noexcept(noexcept(std::forward<_Tp>(__t) & std::forward<_Up>(__u)))
661 -> decltype(std::forward<_Tp>(__t) & std::forward<_Up>(__u))
662 {
return std::forward<_Tp>(__t) & std::forward<_Up>(__u); }
664 typedef __is_transparent is_transparent;
670 template <
typename _Tp,
typename _Up>
673 operator()(_Tp&& __t, _Up&& __u)
const 674 noexcept(noexcept(std::forward<_Tp>(__t) | std::forward<_Up>(__u)))
675 -> decltype(std::forward<_Tp>(__t) | std::forward<_Up>(__u))
676 {
return std::forward<_Tp>(__t) | std::forward<_Up>(__u); }
678 typedef __is_transparent is_transparent;
684 template <
typename _Tp,
typename _Up>
687 operator()(_Tp&& __t, _Up&& __u)
const 688 noexcept(noexcept(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u)))
689 -> decltype(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u))
690 {
return std::forward<_Tp>(__t) ^ std::forward<_Up>(__u); }
692 typedef __is_transparent is_transparent;
698 template <
typename _Tp>
701 operator()(_Tp&& __t)
const 702 noexcept(noexcept(~std::forward<_Tp>(__t)))
703 -> decltype(~std::forward<_Tp>(__t))
704 {
return ~
std::forward<_Tp>(__t); }
706 typedef __is_transparent is_transparent;
740 template<
typename _Predicate>
754 operator()(
const typename _Predicate::argument_type& __x)
const 755 {
return !_M_pred(__x); }
759 template<
typename _Predicate>
766 template<
typename _Predicate>
769 typename _Predicate::second_argument_type, bool>
781 operator()(
const typename _Predicate::first_argument_type& __x,
782 const typename _Predicate::second_argument_type& __y)
const 783 {
return !_M_pred(__x, __y); }
787 template<
typename _Predicate>
817 template<
typename _Arg,
typename _Result>
821 _Result (*_M_ptr)(_Arg);
831 operator()(_Arg __x)
const 832 {
return _M_ptr(__x); }
836 template<
typename _Arg,
typename _Result>
842 template<
typename _Arg1,
typename _Arg2,
typename _Result>
847 _Result (*_M_ptr)(_Arg1, _Arg2);
857 operator()(_Arg1 __x, _Arg2 __y)
const 858 {
return _M_ptr(__x, __y); }
862 template<
typename _Arg1,
typename _Arg2,
typename _Result>
868 template<
typename _Tp>
873 operator()(_Tp& __x)
const 877 operator()(
const _Tp& __x)
const 882 template<
typename _Tp>
struct _Identity<const _Tp> : _Identity<_Tp> { };
884 template<
typename _Pair>
888 typename _Pair::first_type&
889 operator()(_Pair& __x)
const 890 {
return __x.first; }
892 const typename _Pair::first_type&
893 operator()(
const _Pair& __x)
const 894 {
return __x.first; }
896 #if __cplusplus >= 201103L 897 template<
typename _Pair2>
898 typename _Pair2::first_type&
899 operator()(_Pair2& __x)
const 900 {
return __x.first; }
902 template<
typename _Pair2>
903 const typename _Pair2::first_type&
904 operator()(
const _Pair2& __x)
const 905 {
return __x.first; }
909 template<
typename _Pair>
913 typename _Pair::second_type&
914 operator()(_Pair& __x)
const 915 {
return __x.second; }
917 const typename _Pair::second_type&
918 operator()(
const _Pair& __x)
const 919 {
return __x.second; }
940 template<
typename _Ret,
typename _Tp>
949 operator()(_Tp* __p)
const 950 {
return (__p->*_M_f)(); }
958 template<
typename _Ret,
typename _Tp>
967 operator()(
const _Tp* __p)
const 968 {
return (__p->*_M_f)(); }
971 _Ret (_Tp::*_M_f)()
const;
976 template<
typename _Ret,
typename _Tp>
985 operator()(_Tp& __r)
const 986 {
return (__r.*_M_f)(); }
994 template<
typename _Ret,
typename _Tp>
1003 operator()(
const _Tp& __r)
const 1004 {
return (__r.*_M_f)(); }
1007 _Ret (_Tp::*_M_f)()
const;
1012 template<
typename _Ret,
typename _Tp,
typename _Arg>
1021 operator()(_Tp* __p, _Arg __x)
const 1022 {
return (__p->*_M_f)(__x); }
1025 _Ret (_Tp::*_M_f)(_Arg);
1030 template<
typename _Ret,
typename _Tp,
typename _Arg>
1039 operator()(
const _Tp* __p, _Arg __x)
const 1040 {
return (__p->*_M_f)(__x); }
1043 _Ret (_Tp::*_M_f)(_Arg)
const;
1048 template<
typename _Ret,
typename _Tp,
typename _Arg>
1057 operator()(_Tp& __r, _Arg __x)
const 1058 {
return (__r.*_M_f)(__x); }
1061 _Ret (_Tp::*_M_f)(_Arg);
1066 template<
typename _Ret,
typename _Tp,
typename _Arg>
1075 operator()(
const _Tp& __r, _Arg __x)
const 1076 {
return (__r.*_M_f)(__x); }
1079 _Ret (_Tp::*_M_f)(_Arg)
const;
1084 template<
typename _Ret,
typename _Tp>
1086 mem_fun(_Ret (_Tp::*__f)())
1089 template<
typename _Ret,
typename _Tp>
1091 mem_fun(_Ret (_Tp::*__f)()
const)
1094 template<
typename _Ret,
typename _Tp>
1096 mem_fun_ref(_Ret (_Tp::*__f)())
1099 template<
typename _Ret,
typename _Tp>
1101 mem_fun_ref(_Ret (_Tp::*__f)()
const)
1104 template<
typename _Ret,
typename _Tp,
typename _Arg>
1106 mem_fun(_Ret (_Tp::*__f)(_Arg))
1109 template<
typename _Ret,
typename _Tp,
typename _Arg>
1111 mem_fun(_Ret (_Tp::*__f)(_Arg)
const)
1114 template<
typename _Ret,
typename _Tp,
typename _Arg>
1116 mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
1119 template<
typename _Ret,
typename _Tp,
typename _Arg>
1121 mem_fun_ref(_Ret (_Tp::*__f)(_Arg)
const)
1126 _GLIBCXX_END_NAMESPACE_VERSION
1129 #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED
One of the adaptors for member pointers.
pointer_to_unary_function< _Arg, _Result > ptr_fun(_Result(*__x)(_Arg))
One of the adaptors for function pointers.
_GLIBCXX14_CONSTEXPR unary_negate< _Predicate > not1(const _Predicate &__pred)
One of the negation functors.
One of the Boolean operations functors.
One of the math functors.
One of the adaptors for member pointers.
One of the adaptors for member pointers.
One of the math functors.
One of the math functors.
One of the adaptors for member pointers.
_GLIBCXX14_CONSTEXPR binary_negate< _Predicate > not2(const _Predicate &__pred)
One of the negation functors.
_Arg2 second_argument_type
second_argument_type is the type of the second argument
One of the adaptors for function pointers.
One of the comparison functors.
One of the Boolean operations functors.
One of the adaptors for member pointers.
ISO C++ entities toplevel namespace is std.
One of the comparison functors.
One of the math functors.
One of the comparison functors.
One of the Boolean operations functors.
One of the math functors.
One of the adaptors for member pointers.
One of the adaptors for member pointers.
_Result result_type
result_type is the return type
One of the math functors.
One of the adaptors for member pointers.
_Result result_type
result_type is the return type
One of the negation functors.
One of the comparison functors.
_Arg1 first_argument_type
first_argument_type is the type of the first argument
_Arg argument_type
argument_type is the type of the argument
One of the adaptors for function pointers.
One of the comparison functors.
One of the negation functors.
One of the comparison functors.