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 201210 233 template <
typename _Tp,
typename _Up>
236 operator()(_Tp&& __t, _Up&& __u) const
239 {
return std::forward<_Tp>(__t) + std::forward<_Up>(__u); }
241 typedef __is_transparent is_transparent;
248 template <
typename _Tp,
typename _Up>
251 operator()(_Tp&& __t, _Up&& __u)
const 252 noexcept(noexcept(std::forward<_Tp>(__t) - std::forward<_Up>(__u)))
253 -> decltype(std::forward<_Tp>(__t) - std::forward<_Up>(__u))
254 {
return std::forward<_Tp>(__t) - std::forward<_Up>(__u); }
256 typedef __is_transparent is_transparent;
263 template <
typename _Tp,
typename _Up>
266 operator()(_Tp&& __t, _Up&& __u)
const 267 noexcept(noexcept(std::forward<_Tp>(__t) * std::forward<_Up>(__u)))
268 -> decltype(std::forward<_Tp>(__t) * std::forward<_Up>(__u))
269 {
return std::forward<_Tp>(__t) * std::forward<_Up>(__u); }
271 typedef __is_transparent is_transparent;
278 template <
typename _Tp,
typename _Up>
281 operator()(_Tp&& __t, _Up&& __u)
const 282 noexcept(noexcept(std::forward<_Tp>(__t) / std::forward<_Up>(__u)))
283 -> decltype(std::forward<_Tp>(__t) / std::forward<_Up>(__u))
284 {
return std::forward<_Tp>(__t) / std::forward<_Up>(__u); }
286 typedef __is_transparent is_transparent;
293 template <
typename _Tp,
typename _Up>
296 operator()(_Tp&& __t, _Up&& __u)
const 297 noexcept(noexcept(std::forward<_Tp>(__t) % std::forward<_Up>(__u)))
298 -> decltype(std::forward<_Tp>(__t) % std::forward<_Up>(__u))
299 {
return std::forward<_Tp>(__t) % std::forward<_Up>(__u); }
301 typedef __is_transparent is_transparent;
308 template <
typename _Tp>
311 operator()(_Tp&& __t)
const 312 noexcept(noexcept(-std::forward<_Tp>(__t)))
313 -> decltype(-std::forward<_Tp>(__t))
314 {
return -std::forward<_Tp>(__t); }
316 typedef __is_transparent is_transparent;
330 #if __cplusplus > 201103L 331 template<
typename _Tp =
void>
334 template<
typename _Tp =
void>
337 template<
typename _Tp =
void>
340 template<
typename _Tp =
void>
343 template<
typename _Tp =
void>
346 template<
typename _Tp =
void>
351 template<
typename _Tp>
356 operator()(
const _Tp& __x,
const _Tp& __y)
const 357 {
return __x == __y; }
361 template<
typename _Tp>
366 operator()(
const _Tp& __x,
const _Tp& __y)
const 367 {
return __x != __y; }
371 template<
typename _Tp>
376 operator()(
const _Tp& __x,
const _Tp& __y)
const 377 {
return __x > __y; }
381 template<
typename _Tp>
386 operator()(
const _Tp& __x,
const _Tp& __y)
const 387 {
return __x < __y; }
391 template<
typename _Tp>
396 operator()(
const _Tp& __x,
const _Tp& __y)
const 397 {
return __x >= __y; }
401 template<
typename _Tp>
406 operator()(
const _Tp& __x,
const _Tp& __y)
const 407 {
return __x <= __y; }
410 #if __cplusplus > 201103L 415 template <
typename _Tp,
typename _Up>
418 operator()(_Tp&& __t, _Up&& __u)
const 419 noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u)))
420 -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u))
421 {
return std::forward<_Tp>(__t) == std::forward<_Up>(__u); }
423 typedef __is_transparent is_transparent;
430 template <
typename _Tp,
typename _Up>
433 operator()(_Tp&& __t, _Up&& __u)
const 434 noexcept(noexcept(std::forward<_Tp>(__t) != std::forward<_Up>(__u)))
435 -> decltype(std::forward<_Tp>(__t) != std::forward<_Up>(__u))
436 {
return std::forward<_Tp>(__t) != std::forward<_Up>(__u); }
438 typedef __is_transparent is_transparent;
445 template <
typename _Tp,
typename _Up>
448 operator()(_Tp&& __t, _Up&& __u)
const 449 noexcept(noexcept(std::forward<_Tp>(__t) > std::forward<_Up>(__u)))
450 -> decltype(std::forward<_Tp>(__t) > std::forward<_Up>(__u))
451 {
return std::forward<_Tp>(__t) > std::forward<_Up>(__u); }
453 typedef __is_transparent is_transparent;
460 template <
typename _Tp,
typename _Up>
463 operator()(_Tp&& __t, _Up&& __u)
const 464 noexcept(noexcept(std::forward<_Tp>(__t) < std::forward<_Up>(__u)))
465 -> decltype(std::forward<_Tp>(__t) < std::forward<_Up>(__u))
466 {
return std::forward<_Tp>(__t) < std::forward<_Up>(__u); }
468 typedef __is_transparent is_transparent;
475 template <
typename _Tp,
typename _Up>
478 operator()(_Tp&& __t, _Up&& __u)
const 479 noexcept(noexcept(std::forward<_Tp>(__t) >= std::forward<_Up>(__u)))
480 -> decltype(std::forward<_Tp>(__t) >= std::forward<_Up>(__u))
481 {
return std::forward<_Tp>(__t) >= std::forward<_Up>(__u); }
483 typedef __is_transparent is_transparent;
490 template <
typename _Tp,
typename _Up>
493 operator()(_Tp&& __t, _Up&& __u)
const 494 noexcept(noexcept(std::forward<_Tp>(__t) <= std::forward<_Up>(__u)))
495 -> decltype(std::forward<_Tp>(__t) <= std::forward<_Up>(__u))
496 {
return std::forward<_Tp>(__t) <= std::forward<_Up>(__u); }
498 typedef __is_transparent is_transparent;
512 #if __cplusplus > 201103L 513 template<
typename _Tp =
void>
516 template<
typename _Tp =
void>
519 template<
typename _Tp =
void>
524 template<
typename _Tp>
529 operator()(
const _Tp& __x,
const _Tp& __y)
const 530 {
return __x && __y; }
534 template<
typename _Tp>
539 operator()(
const _Tp& __x,
const _Tp& __y)
const 540 {
return __x || __y; }
544 template<
typename _Tp>
549 operator()(
const _Tp& __x)
const 553 #if __cplusplus > 201103L 558 template <
typename _Tp,
typename _Up>
561 operator()(_Tp&& __t, _Up&& __u)
const 562 noexcept(noexcept(std::forward<_Tp>(__t) && std::forward<_Up>(__u)))
563 -> decltype(std::forward<_Tp>(__t) && std::forward<_Up>(__u))
564 {
return std::forward<_Tp>(__t) && std::forward<_Up>(__u); }
566 typedef __is_transparent is_transparent;
573 template <
typename _Tp,
typename _Up>
576 operator()(_Tp&& __t, _Up&& __u)
const 577 noexcept(noexcept(std::forward<_Tp>(__t) || std::forward<_Up>(__u)))
578 -> decltype(std::forward<_Tp>(__t) || std::forward<_Up>(__u))
579 {
return std::forward<_Tp>(__t) || std::forward<_Up>(__u); }
581 typedef __is_transparent is_transparent;
588 template <
typename _Tp>
591 operator()(_Tp&& __t)
const 592 noexcept(noexcept(!std::forward<_Tp>(__t)))
593 -> decltype(!std::forward<_Tp>(__t))
594 {
return !std::forward<_Tp>(__t); }
596 typedef __is_transparent is_transparent;
601 #if __cplusplus > 201103L 602 template<
typename _Tp =
void>
605 template<
typename _Tp =
void>
608 template<
typename _Tp =
void>
611 template<
typename _Tp =
void>
617 template<
typename _Tp>
622 operator()(
const _Tp& __x,
const _Tp& __y)
const 623 {
return __x & __y; }
626 template<
typename _Tp>
631 operator()(
const _Tp& __x,
const _Tp& __y)
const 632 {
return __x | __y; }
635 template<
typename _Tp>
640 operator()(
const _Tp& __x,
const _Tp& __y)
const 641 {
return __x ^ __y; }
644 template<
typename _Tp>
649 operator()(
const _Tp& __x)
const 653 #if __cplusplus > 201103L 657 template <
typename _Tp,
typename _Up>
660 operator()(_Tp&& __t, _Up&& __u)
const 661 noexcept(noexcept(std::forward<_Tp>(__t) & std::forward<_Up>(__u)))
662 -> decltype(std::forward<_Tp>(__t) & std::forward<_Up>(__u))
663 {
return std::forward<_Tp>(__t) & std::forward<_Up>(__u); }
665 typedef __is_transparent is_transparent;
671 template <
typename _Tp,
typename _Up>
674 operator()(_Tp&& __t, _Up&& __u)
const 675 noexcept(noexcept(std::forward<_Tp>(__t) | std::forward<_Up>(__u)))
676 -> decltype(std::forward<_Tp>(__t) | std::forward<_Up>(__u))
677 {
return std::forward<_Tp>(__t) | std::forward<_Up>(__u); }
679 typedef __is_transparent is_transparent;
685 template <
typename _Tp,
typename _Up>
688 operator()(_Tp&& __t, _Up&& __u)
const 689 noexcept(noexcept(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u)))
690 -> decltype(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u))
691 {
return std::forward<_Tp>(__t) ^ std::forward<_Up>(__u); }
693 typedef __is_transparent is_transparent;
699 template <
typename _Tp>
702 operator()(_Tp&& __t)
const 703 noexcept(noexcept(~std::forward<_Tp>(__t)))
704 -> decltype(~std::forward<_Tp>(__t))
705 {
return ~
std::forward<_Tp>(__t); }
707 typedef __is_transparent is_transparent;
741 template<
typename _Predicate>
755 operator()(
const typename _Predicate::argument_type& __x)
const 756 {
return !_M_pred(__x); }
760 template<
typename _Predicate>
767 template<
typename _Predicate>
770 typename _Predicate::second_argument_type, bool>
782 operator()(
const typename _Predicate::first_argument_type& __x,
783 const typename _Predicate::second_argument_type& __y)
const 784 {
return !_M_pred(__x, __y); }
788 template<
typename _Predicate>
818 template<
typename _Arg,
typename _Result>
822 _Result (*_M_ptr)(_Arg);
832 operator()(_Arg __x)
const 833 {
return _M_ptr(__x); }
837 template<
typename _Arg,
typename _Result>
843 template<
typename _Arg1,
typename _Arg2,
typename _Result>
848 _Result (*_M_ptr)(_Arg1, _Arg2);
858 operator()(_Arg1 __x, _Arg2 __y)
const 859 {
return _M_ptr(__x, __y); }
863 template<
typename _Arg1,
typename _Arg2,
typename _Result>
869 template<
typename _Tp>
874 operator()(_Tp& __x)
const 878 operator()(
const _Tp& __x)
const 882 template<
typename _Pair>
886 typename _Pair::first_type&
887 operator()(_Pair& __x)
const 888 {
return __x.first; }
890 const typename _Pair::first_type&
891 operator()(
const _Pair& __x)
const 892 {
return __x.first; }
894 #if __cplusplus >= 201103L 895 template<
typename _Pair2>
896 typename _Pair2::first_type&
897 operator()(_Pair2& __x)
const 898 {
return __x.first; }
900 template<
typename _Pair2>
901 const typename _Pair2::first_type&
902 operator()(
const _Pair2& __x)
const 903 {
return __x.first; }
907 template<
typename _Pair>
911 typename _Pair::second_type&
912 operator()(_Pair& __x)
const 913 {
return __x.second; }
915 const typename _Pair::second_type&
916 operator()(
const _Pair& __x)
const 917 {
return __x.second; }
938 template<
typename _Ret,
typename _Tp>
947 operator()(_Tp* __p)
const 948 {
return (__p->*_M_f)(); }
956 template<
typename _Ret,
typename _Tp>
965 operator()(
const _Tp* __p)
const 966 {
return (__p->*_M_f)(); }
969 _Ret (_Tp::*_M_f)()
const;
974 template<
typename _Ret,
typename _Tp>
983 operator()(_Tp& __r)
const 984 {
return (__r.*_M_f)(); }
992 template<
typename _Ret,
typename _Tp>
1001 operator()(
const _Tp& __r)
const 1002 {
return (__r.*_M_f)(); }
1005 _Ret (_Tp::*_M_f)()
const;
1010 template<
typename _Ret,
typename _Tp,
typename _Arg>
1019 operator()(_Tp* __p, _Arg __x)
const 1020 {
return (__p->*_M_f)(__x); }
1023 _Ret (_Tp::*_M_f)(_Arg);
1028 template<
typename _Ret,
typename _Tp,
typename _Arg>
1037 operator()(
const _Tp* __p, _Arg __x)
const 1038 {
return (__p->*_M_f)(__x); }
1041 _Ret (_Tp::*_M_f)(_Arg)
const;
1046 template<
typename _Ret,
typename _Tp,
typename _Arg>
1055 operator()(_Tp& __r, _Arg __x)
const 1056 {
return (__r.*_M_f)(__x); }
1059 _Ret (_Tp::*_M_f)(_Arg);
1064 template<
typename _Ret,
typename _Tp,
typename _Arg>
1073 operator()(
const _Tp& __r, _Arg __x)
const 1074 {
return (__r.*_M_f)(__x); }
1077 _Ret (_Tp::*_M_f)(_Arg)
const;
1082 template<
typename _Ret,
typename _Tp>
1084 mem_fun(_Ret (_Tp::*__f)())
1087 template<
typename _Ret,
typename _Tp>
1089 mem_fun(_Ret (_Tp::*__f)()
const)
1092 template<
typename _Ret,
typename _Tp>
1094 mem_fun_ref(_Ret (_Tp::*__f)())
1097 template<
typename _Ret,
typename _Tp>
1099 mem_fun_ref(_Ret (_Tp::*__f)()
const)
1102 template<
typename _Ret,
typename _Tp,
typename _Arg>
1104 mem_fun(_Ret (_Tp::*__f)(_Arg))
1107 template<
typename _Ret,
typename _Tp,
typename _Arg>
1109 mem_fun(_Ret (_Tp::*__f)(_Arg)
const)
1112 template<
typename _Ret,
typename _Tp,
typename _Arg>
1114 mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
1117 template<
typename _Ret,
typename _Tp,
typename _Arg>
1119 mem_fun_ref(_Ret (_Tp::*__f)(_Arg)
const)
1124 _GLIBCXX_END_NAMESPACE_VERSION
1127 #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED _Arg argument_type
argument_type is the type of the argument
One of the adaptors for function pointers.
One of the adaptors for member pointers.
One of the Boolean operations functors.
_GLIBCXX14_CONSTEXPR binary_negate< _Predicate > not2(const _Predicate &__pred)
One of the negation functors.
One of the comparison functors.
One of the math functors.
One of the math functors.
One of the negation functors.
_Arg2 second_argument_type
second_argument_type is the type of the second argument
_Result result_type
result_type is the return type
One of the negation functors.
One of the adaptors for function pointers.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
One of the adaptors for member pointers.
One of the math functors.
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.
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.
One of the Boolean operations functors.
One of the comparison functors.
One of the comparison functors.
One of the math functors.
One of the adaptors for member pointers.
_GLIBCXX14_CONSTEXPR unary_negate< _Predicate > not1(const _Predicate &__pred)
One of the negation functors.
_Arg1 first_argument_type
first_argument_type is the type of the first argument
One of the comparison functors.
One of the adaptors for member pointers.
One of the Boolean operations functors.
One of the comparison functors.
ISO C++ entities toplevel namespace is std.
One of the adaptors for member pointers.
One of the math functors.
One of the comparison functors.