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>
170 operator()(
const _Tp& __x,
const _Tp& __y)
const
171 {
return __x + __y; }
175 template<
typename _Tp>
179 operator()(
const _Tp& __x,
const _Tp& __y)
const
180 {
return __x - __y; }
184 template<
typename _Tp>
188 operator()(
const _Tp& __x,
const _Tp& __y)
const
189 {
return __x * __y; }
193 template<
typename _Tp>
197 operator()(
const _Tp& __x,
const _Tp& __y)
const
198 {
return __x / __y; }
202 template<
typename _Tp>
206 operator()(
const _Tp& __x,
const _Tp& __y)
const
207 {
return __x % __y; }
211 template<
typename _Tp>
215 operator()(
const _Tp& __x)
const
219 #if __cplusplus > 201103L
221 #define __cpp_lib_transparent_operators 201210
227 template <
typename _Tp,
typename _Up>
229 operator()(_Tp&& __t, _Up&& __u) const
232 {
return std::forward<_Tp>(__t) + std::forward<_Up>(__u); }
234 typedef __is_transparent is_transparent;
241 template <
typename _Tp,
typename _Up>
243 operator()(_Tp&& __t, _Up&& __u) const
246 {
return std::forward<_Tp>(__t) - std::forward<_Up>(__u); }
248 typedef __is_transparent is_transparent;
253 struct multiplies<void>
255 template <
typename _Tp,
typename _Up>
257 operator()(_Tp&& __t, _Up&& __u) const
260 {
return std::forward<_Tp>(__t) * std::forward<_Up>(__u); }
262 typedef __is_transparent is_transparent;
269 template <
typename _Tp,
typename _Up>
271 operator()(_Tp&& __t, _Up&& __u) const
274 {
return std::forward<_Tp>(__t) / std::forward<_Up>(__u); }
276 typedef __is_transparent is_transparent;
283 template <
typename _Tp,
typename _Up>
285 operator()(_Tp&& __t, _Up&& __u) const
288 {
return std::forward<_Tp>(__t) % std::forward<_Up>(__u); }
290 typedef __is_transparent is_transparent;
297 template <
typename _Tp>
299 operator()(_Tp&& __t) const
302 {
return -std::forward<_Tp>(__t); }
304 typedef __is_transparent is_transparent;
318 #if __cplusplus > 201103L
319 template<
typename _Tp =
void>
322 template<
typename _Tp =
void>
325 template<
typename _Tp =
void>
328 template<
typename _Tp =
void>
331 template<
typename _Tp =
void>
332 struct greater_equal;
334 template<
typename _Tp =
void>
339 template<
typename _Tp>
343 operator()(
const _Tp& __x,
const _Tp& __y)
const
344 {
return __x == __y; }
348 template<
typename _Tp>
352 operator()(
const _Tp& __x,
const _Tp& __y)
const
353 {
return __x != __y; }
357 template<
typename _Tp>
361 operator()(
const _Tp& __x,
const _Tp& __y)
const
362 {
return __x > __y; }
366 template<
typename _Tp>
370 operator()(
const _Tp& __x,
const _Tp& __y)
const
371 {
return __x < __y; }
375 template<
typename _Tp>
379 operator()(
const _Tp& __x,
const _Tp& __y)
const
380 {
return __x >= __y; }
384 template<
typename _Tp>
388 operator()(
const _Tp& __x,
const _Tp& __y)
const
389 {
return __x <= __y; }
392 #if __cplusplus > 201103L
397 template <
typename _Tp,
typename _Up>
399 operator()(_Tp&& __t, _Up&& __u) const
402 {
return std::forward<_Tp>(__t) == std::forward<_Up>(__u); }
404 typedef __is_transparent is_transparent;
409 struct not_equal_to<void>
411 template <
typename _Tp,
typename _Up>
413 operator()(_Tp&& __t, _Up&& __u) const
416 {
return std::forward<_Tp>(__t) != std::forward<_Up>(__u); }
418 typedef __is_transparent is_transparent;
425 template <
typename _Tp,
typename _Up>
427 operator()(_Tp&& __t, _Up&& __u) const
430 {
return std::forward<_Tp>(__t) > std::forward<_Up>(__u); }
432 typedef __is_transparent is_transparent;
439 template <
typename _Tp,
typename _Up>
441 operator()(_Tp&& __t, _Up&& __u) const
444 {
return std::forward<_Tp>(__t) < std::forward<_Up>(__u); }
446 typedef __is_transparent is_transparent;
451 struct greater_equal<void>
453 template <
typename _Tp,
typename _Up>
455 operator()(_Tp&& __t, _Up&& __u) const
458 {
return std::forward<_Tp>(__t) >= std::forward<_Up>(__u); }
460 typedef __is_transparent is_transparent;
465 struct less_equal<void>
467 template <
typename _Tp,
typename _Up>
469 operator()(_Tp&& __t, _Up&& __u) const
472 {
return std::forward<_Tp>(__t) <= std::forward<_Up>(__u); }
474 typedef __is_transparent is_transparent;
488 #if __cplusplus > 201103L
489 template<
typename _Tp =
void>
492 template<
typename _Tp =
void>
495 template<
typename _Tp =
void>
500 template<
typename _Tp>
504 operator()(
const _Tp& __x,
const _Tp& __y)
const
505 {
return __x && __y; }
509 template<
typename _Tp>
513 operator()(
const _Tp& __x,
const _Tp& __y)
const
514 {
return __x || __y; }
518 template<
typename _Tp>
522 operator()(
const _Tp& __x)
const
526 #if __cplusplus > 201103L
531 template <
typename _Tp,
typename _Up>
533 operator()(_Tp&& __t, _Up&& __u) const
536 {
return std::forward<_Tp>(__t) && std::forward<_Up>(__u); }
538 typedef __is_transparent is_transparent;
543 struct logical_or<void>
545 template <
typename _Tp,
typename _Up>
547 operator()(_Tp&& __t, _Up&& __u) const
550 {
return std::forward<_Tp>(__t) || std::forward<_Up>(__u); }
552 typedef __is_transparent is_transparent;
557 struct logical_not<void>
559 template <
typename _Tp>
561 operator()(_Tp&& __t) const
564 {
return !std::forward<_Tp>(__t); }
566 typedef __is_transparent is_transparent;
571 #if __cplusplus > 201103L
572 template<
typename _Tp =
void>
575 template<
typename _Tp =
void>
578 template<
typename _Tp =
void>
581 template<
typename _Tp =
void>
587 template<
typename _Tp>
588 struct bit_and :
public binary_function<_Tp, _Tp, _Tp>
591 operator()(
const _Tp& __x,
const _Tp& __y)
const
592 {
return __x & __y; }
595 template<
typename _Tp>
596 struct bit_or :
public binary_function<_Tp, _Tp, _Tp>
599 operator()(
const _Tp& __x,
const _Tp& __y)
const
600 {
return __x | __y; }
603 template<
typename _Tp>
604 struct bit_xor :
public binary_function<_Tp, _Tp, _Tp>
607 operator()(
const _Tp& __x,
const _Tp& __y)
const
608 {
return __x ^ __y; }
611 template<
typename _Tp>
612 struct bit_not :
public unary_function<_Tp, _Tp>
615 operator()(
const _Tp& __x)
const
619 #if __cplusplus > 201103L
623 template <
typename _Tp,
typename _Up>
625 operator()(_Tp&& __t, _Up&& __u) const
628 {
return std::forward<_Tp>(__t) & std::forward<_Up>(__u); }
630 typedef __is_transparent is_transparent;
636 template <
typename _Tp,
typename _Up>
638 operator()(_Tp&& __t, _Up&& __u) const
641 {
return std::forward<_Tp>(__t) | std::forward<_Up>(__u); }
643 typedef __is_transparent is_transparent;
649 template <
typename _Tp,
typename _Up>
651 operator()(_Tp&& __t, _Up&& __u) const
654 {
return std::forward<_Tp>(__t) ^ std::forward<_Up>(__u); }
656 typedef __is_transparent is_transparent;
662 template <
typename _Tp>
664 operator()(_Tp&& __t) const
667 {
return ~
std::forward<_Tp>(__t); }
669 typedef __is_transparent is_transparent;
703 template<
typename _Predicate>
715 operator()(
const typename _Predicate::argument_type& __x)
const
716 {
return !_M_pred(__x); }
720 template<
typename _Predicate>
726 template<
typename _Predicate>
729 typename _Predicate::second_argument_type, bool>
739 operator()(
const typename _Predicate::first_argument_type& __x,
740 const typename _Predicate::second_argument_type& __y)
const
741 {
return !_M_pred(__x, __y); }
745 template<
typename _Predicate>
774 template<
typename _Arg,
typename _Result>
778 _Result (*_M_ptr)(_Arg);
788 operator()(_Arg __x)
const
789 {
return _M_ptr(__x); }
793 template<
typename _Arg,
typename _Result>
799 template<
typename _Arg1,
typename _Arg2,
typename _Result>
804 _Result (*_M_ptr)(_Arg1, _Arg2);
814 operator()(_Arg1 __x, _Arg2 __y)
const
815 {
return _M_ptr(__x, __y); }
819 template<
typename _Arg1,
typename _Arg2,
typename _Result>
825 template<
typename _Tp>
827 :
public unary_function<_Tp,_Tp>
830 operator()(_Tp& __x)
const
834 operator()(
const _Tp& __x)
const
838 template<
typename _Pair>
840 :
public unary_function<_Pair, typename _Pair::first_type>
842 typename _Pair::first_type&
843 operator()(_Pair& __x)
const
844 {
return __x.first; }
846 const typename _Pair::first_type&
847 operator()(
const _Pair& __x)
const
848 {
return __x.first; }
850 #if __cplusplus >= 201103L
851 template<
typename _Pair2>
852 typename _Pair2::first_type&
853 operator()(_Pair2& __x)
const
854 {
return __x.first; }
856 template<
typename _Pair2>
857 const typename _Pair2::first_type&
858 operator()(
const _Pair2& __x)
const
859 {
return __x.first; }
863 template<
typename _Pair>
865 :
public unary_function<_Pair, typename _Pair::second_type>
867 typename _Pair::second_type&
868 operator()(_Pair& __x)
const
869 {
return __x.second; }
871 const typename _Pair::second_type&
872 operator()(
const _Pair& __x)
const
873 {
return __x.second; }
894 template<
typename _Ret,
typename _Tp>
903 operator()(_Tp* __p)
const
904 {
return (__p->*_M_f)(); }
912 template<
typename _Ret,
typename _Tp>
921 operator()(
const _Tp* __p)
const
922 {
return (__p->*_M_f)(); }
925 _Ret (_Tp::*_M_f)()
const;
930 template<
typename _Ret,
typename _Tp>
939 operator()(_Tp& __r)
const
940 {
return (__r.*_M_f)(); }
948 template<
typename _Ret,
typename _Tp>
957 operator()(
const _Tp& __r)
const
958 {
return (__r.*_M_f)(); }
961 _Ret (_Tp::*_M_f)()
const;
966 template<
typename _Ret,
typename _Tp,
typename _Arg>
975 operator()(_Tp* __p, _Arg __x)
const
976 {
return (__p->*_M_f)(__x); }
979 _Ret (_Tp::*_M_f)(_Arg);
984 template<
typename _Ret,
typename _Tp,
typename _Arg>
993 operator()(
const _Tp* __p, _Arg __x)
const
994 {
return (__p->*_M_f)(__x); }
997 _Ret (_Tp::*_M_f)(_Arg)
const;
1002 template<
typename _Ret,
typename _Tp,
typename _Arg>
1011 operator()(_Tp& __r, _Arg __x)
const
1012 {
return (__r.*_M_f)(__x); }
1015 _Ret (_Tp::*_M_f)(_Arg);
1020 template<
typename _Ret,
typename _Tp,
typename _Arg>
1029 operator()(
const _Tp& __r, _Arg __x)
const
1030 {
return (__r.*_M_f)(__x); }
1033 _Ret (_Tp::*_M_f)(_Arg)
const;
1038 template<
typename _Ret,
typename _Tp>
1040 mem_fun(_Ret (_Tp::*__f)())
1043 template<
typename _Ret,
typename _Tp>
1044 inline const_mem_fun_t<_Ret, _Tp>
1045 mem_fun(_Ret (_Tp::*__f)()
const)
1046 {
return const_mem_fun_t<_Ret, _Tp>(__f); }
1048 template<
typename _Ret,
typename _Tp>
1049 inline mem_fun_ref_t<_Ret, _Tp>
1050 mem_fun_ref(_Ret (_Tp::*__f)())
1051 {
return mem_fun_ref_t<_Ret, _Tp>(__f); }
1053 template<
typename _Ret,
typename _Tp>
1054 inline const_mem_fun_ref_t<_Ret, _Tp>
1055 mem_fun_ref(_Ret (_Tp::*__f)()
const)
1056 {
return const_mem_fun_ref_t<_Ret, _Tp>(__f); }
1058 template<
typename _Ret,
typename _Tp,
typename _Arg>
1059 inline mem_fun1_t<_Ret, _Tp, _Arg>
1060 mem_fun(_Ret (_Tp::*__f)(_Arg))
1061 {
return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
1063 template<
typename _Ret,
typename _Tp,
typename _Arg>
1064 inline const_mem_fun1_t<_Ret, _Tp, _Arg>
1065 mem_fun(_Ret (_Tp::*__f)(_Arg)
const)
1066 {
return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
1068 template<
typename _Ret,
typename _Tp,
typename _Arg>
1069 inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
1070 mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
1071 {
return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
1073 template<
typename _Ret,
typename _Tp,
typename _Arg>
1074 inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
1075 mem_fun_ref(_Ret (_Tp::*__f)(_Arg)
const)
1076 {
return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
1080 _GLIBCXX_END_NAMESPACE_VERSION
1083 #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED
_Result result_type
result_type is the return type
One of the math functors.
One of the Boolean operations functors.
One of the comparison functors.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
One of the math functors.
One of the adaptors for member pointers.
_Arg1 first_argument_type
first_argument_type is the type of the first argument
One of the math functors.
One of the negation functors.
One of the adaptors for member pointers.
One of the comparison functors.
ISO C++ entities toplevel namespace is std.
One of the Boolean operations functors.
One of the negation functors.
One of the comparison functors.
One of the adaptors for member pointers.
One of the math functors.
One of the comparison functors.
unary_negate< _Predicate > not1(const _Predicate &__pred)
One of the negation functors.
One of the math functors.
One of the adaptors for member pointers.
_Result result_type
result_type is the return type
_Arg2 second_argument_type
second_argument_type is the type of the second argument
One of the adaptors for function pointers.
One of the math functors.
One of the Boolean operations functors.
pointer_to_unary_function< _Arg, _Result > ptr_fun(_Result(*__x)(_Arg))
One of the adaptors for function pointers.
One of the comparison functors.
One of the adaptors for member pointers.
One of the adaptors for member pointers.
One of the adaptors for function pointers.
_Arg argument_type
argument_type is the type of the argument
One of the adaptors for member pointers.
binary_negate< _Predicate > not2(const _Predicate &__pred)
One of the negation functors.
One of the comparison functors.
One of the adaptors for member pointers.