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
223 template <
typename _Tp,
typename _Up>
225 operator()(_Tp&& __t, _Up&& __u) const
226 noexcept(noexcept(std::
forward<_Tp>(__t) + std::
forward<_Up>(__u)))
228 {
return std::forward<_Tp>(__t) + std::forward<_Up>(__u); }
230 typedef __is_transparent is_transparent;
237 template <
typename _Tp,
typename _Up>
239 operator()(_Tp&& __t, _Up&& __u) const
240 noexcept(noexcept(std::
forward<_Tp>(__t) - std::
forward<_Up>(__u)))
242 {
return std::forward<_Tp>(__t) - std::forward<_Up>(__u); }
244 typedef __is_transparent is_transparent;
249 struct multiplies<void>
251 template <
typename _Tp,
typename _Up>
253 operator()(_Tp&& __t, _Up&& __u) const
254 noexcept(noexcept(std::
forward<_Tp>(__t) * std::
forward<_Up>(__u)))
256 {
return std::forward<_Tp>(__t) * std::forward<_Up>(__u); }
258 typedef __is_transparent is_transparent;
265 template <
typename _Tp,
typename _Up>
267 operator()(_Tp&& __t, _Up&& __u) const
268 noexcept(noexcept(std::
forward<_Tp>(__t) / std::
forward<_Up>(__u)))
270 {
return std::forward<_Tp>(__t) / std::forward<_Up>(__u); }
272 typedef __is_transparent is_transparent;
279 template <
typename _Tp,
typename _Up>
281 operator()(_Tp&& __t, _Up&& __u) const
282 noexcept(noexcept(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>
295 operator()(_Tp&& __t) const
296 noexcept(noexcept(-std::
forward<_Tp>(__t)))
297 -> decltype(-std::
forward<_Tp>(__t))
298 {
return -std::forward<_Tp>(__t); }
300 typedef __is_transparent is_transparent;
314 #if __cplusplus > 201103L
315 template<
typename _Tp =
void>
318 template<
typename _Tp =
void>
321 template<
typename _Tp =
void>
324 template<
typename _Tp =
void>
327 template<
typename _Tp =
void>
328 struct greater_equal;
330 template<
typename _Tp =
void>
335 template<
typename _Tp>
339 operator()(
const _Tp& __x,
const _Tp& __y)
const
340 {
return __x == __y; }
344 template<
typename _Tp>
348 operator()(
const _Tp& __x,
const _Tp& __y)
const
349 {
return __x != __y; }
353 template<
typename _Tp>
357 operator()(
const _Tp& __x,
const _Tp& __y)
const
358 {
return __x > __y; }
362 template<
typename _Tp>
366 operator()(
const _Tp& __x,
const _Tp& __y)
const
367 {
return __x < __y; }
371 template<
typename _Tp>
375 operator()(
const _Tp& __x,
const _Tp& __y)
const
376 {
return __x >= __y; }
380 template<
typename _Tp>
384 operator()(
const _Tp& __x,
const _Tp& __y)
const
385 {
return __x <= __y; }
388 #if __cplusplus > 201103L
393 template <
typename _Tp,
typename _Up>
395 operator()(_Tp&& __t, _Up&& __u) const
396 noexcept(noexcept(std::
forward<_Tp>(__t) == std::
forward<_Up>(__u)))
398 {
return std::forward<_Tp>(__t) == std::forward<_Up>(__u); }
400 typedef __is_transparent is_transparent;
405 struct not_equal_to<void>
407 template <
typename _Tp,
typename _Up>
409 operator()(_Tp&& __t, _Up&& __u) const
410 noexcept(noexcept(std::
forward<_Tp>(__t) != std::
forward<_Up>(__u)))
412 {
return std::forward<_Tp>(__t) != std::forward<_Up>(__u); }
414 typedef __is_transparent is_transparent;
421 template <
typename _Tp,
typename _Up>
423 operator()(_Tp&& __t, _Up&& __u) const
424 noexcept(noexcept(std::
forward<_Tp>(__t) > std::
forward<_Up>(__u)))
426 {
return std::forward<_Tp>(__t) > std::forward<_Up>(__u); }
428 typedef __is_transparent is_transparent;
435 template <
typename _Tp,
typename _Up>
437 operator()(_Tp&& __t, _Up&& __u) const
438 noexcept(noexcept(std::
forward<_Tp>(__t) < std::
forward<_Up>(__u)))
440 {
return std::forward<_Tp>(__t) < std::forward<_Up>(__u); }
442 typedef __is_transparent is_transparent;
447 struct greater_equal<void>
449 template <
typename _Tp,
typename _Up>
451 operator()(_Tp&& __t, _Up&& __u) const
452 noexcept(noexcept(std::
forward<_Tp>(__t) >= std::
forward<_Up>(__u)))
454 {
return std::forward<_Tp>(__t) >= std::forward<_Up>(__u); }
456 typedef __is_transparent is_transparent;
461 struct less_equal<void>
463 template <
typename _Tp,
typename _Up>
465 operator()(_Tp&& __t, _Up&& __u) const
466 noexcept(noexcept(std::
forward<_Tp>(__t) <= std::
forward<_Up>(__u)))
468 {
return std::forward<_Tp>(__t) <= std::forward<_Up>(__u); }
470 typedef __is_transparent is_transparent;
484 #if __cplusplus > 201103L
485 template<
typename _Tp =
void>
488 template<
typename _Tp =
void>
491 template<
typename _Tp =
void>
496 template<
typename _Tp>
500 operator()(
const _Tp& __x,
const _Tp& __y)
const
501 {
return __x && __y; }
505 template<
typename _Tp>
509 operator()(
const _Tp& __x,
const _Tp& __y)
const
510 {
return __x || __y; }
514 template<
typename _Tp>
518 operator()(
const _Tp& __x)
const
522 #if __cplusplus > 201103L
527 template <
typename _Tp,
typename _Up>
529 operator()(_Tp&& __t, _Up&& __u) const
530 noexcept(noexcept(std::
forward<_Tp>(__t) && std::
forward<_Up>(__u)))
532 {
return std::forward<_Tp>(__t) && std::forward<_Up>(__u); }
534 typedef __is_transparent is_transparent;
539 struct logical_or<void>
541 template <
typename _Tp,
typename _Up>
543 operator()(_Tp&& __t, _Up&& __u) const
544 noexcept(noexcept(std::
forward<_Tp>(__t) || std::
forward<_Up>(__u)))
546 {
return std::forward<_Tp>(__t) || std::forward<_Up>(__u); }
548 typedef __is_transparent is_transparent;
553 struct logical_not<void>
555 template <
typename _Tp>
557 operator()(_Tp&& __t) const
558 noexcept(noexcept(!std::
forward<_Tp>(__t)))
559 -> decltype(!std::
forward<_Tp>(__t))
560 {
return !std::forward<_Tp>(__t); }
562 typedef __is_transparent is_transparent;
567 #if __cplusplus > 201103L
568 template<
typename _Tp =
void>
571 template<
typename _Tp =
void>
574 template<
typename _Tp =
void>
577 template<
typename _Tp =
void>
583 template<
typename _Tp>
584 struct bit_and :
public binary_function<_Tp, _Tp, _Tp>
587 operator()(
const _Tp& __x,
const _Tp& __y)
const
588 {
return __x & __y; }
591 template<
typename _Tp>
592 struct bit_or :
public binary_function<_Tp, _Tp, _Tp>
595 operator()(
const _Tp& __x,
const _Tp& __y)
const
596 {
return __x | __y; }
599 template<
typename _Tp>
600 struct bit_xor :
public binary_function<_Tp, _Tp, _Tp>
603 operator()(
const _Tp& __x,
const _Tp& __y)
const
604 {
return __x ^ __y; }
607 template<
typename _Tp>
608 struct bit_not :
public unary_function<_Tp, _Tp>
611 operator()(
const _Tp& __x)
const
615 #if __cplusplus > 201103L
619 template <
typename _Tp,
typename _Up>
621 operator()(_Tp&& __t, _Up&& __u) const
622 noexcept(noexcept(std::
forward<_Tp>(__t) & std::
forward<_Up>(__u)))
624 {
return std::forward<_Tp>(__t) & std::forward<_Up>(__u); }
626 typedef __is_transparent is_transparent;
632 template <
typename _Tp,
typename _Up>
634 operator()(_Tp&& __t, _Up&& __u) const
635 noexcept(noexcept(std::
forward<_Tp>(__t) | std::
forward<_Up>(__u)))
637 {
return std::forward<_Tp>(__t) | std::forward<_Up>(__u); }
639 typedef __is_transparent is_transparent;
645 template <
typename _Tp,
typename _Up>
647 operator()(_Tp&& __t, _Up&& __u) const
648 noexcept(noexcept(std::
forward<_Tp>(__t) ^ std::
forward<_Up>(__u)))
650 {
return std::forward<_Tp>(__t) ^ std::forward<_Up>(__u); }
652 typedef __is_transparent is_transparent;
658 template <
typename _Tp>
660 operator()(_Tp&& __t) const
661 noexcept(noexcept(~std::
forward<_Tp>(__t)))
662 -> decltype(~std::
forward<_Tp>(__t))
663 {
return ~std::forward<_Tp>(__t); }
665 typedef __is_transparent is_transparent;
699 template<
typename _Predicate>
711 operator()(
const typename _Predicate::argument_type& __x)
const
712 {
return !_M_pred(__x); }
716 template<
typename _Predicate>
722 template<
typename _Predicate>
725 typename _Predicate::second_argument_type, bool>
735 operator()(
const typename _Predicate::first_argument_type& __x,
736 const typename _Predicate::second_argument_type& __y)
const
737 {
return !_M_pred(__x, __y); }
741 template<
typename _Predicate>
770 template<
typename _Arg,
typename _Result>
774 _Result (*_M_ptr)(_Arg);
784 operator()(_Arg __x)
const
785 {
return _M_ptr(__x); }
789 template<
typename _Arg,
typename _Result>
795 template<
typename _Arg1,
typename _Arg2,
typename _Result>
800 _Result (*_M_ptr)(_Arg1, _Arg2);
810 operator()(_Arg1 __x, _Arg2 __y)
const
811 {
return _M_ptr(__x, __y); }
815 template<
typename _Arg1,
typename _Arg2,
typename _Result>
821 template<
typename _Tp>
823 :
public unary_function<_Tp,_Tp>
826 operator()(_Tp& __x)
const
830 operator()(
const _Tp& __x)
const
834 template<
typename _Pair>
836 :
public unary_function<_Pair, typename _Pair::first_type>
838 typename _Pair::first_type&
839 operator()(_Pair& __x)
const
840 {
return __x.first; }
842 const typename _Pair::first_type&
843 operator()(
const _Pair& __x)
const
844 {
return __x.first; }
846 #if __cplusplus >= 201103L
847 template<
typename _Pair2>
848 typename _Pair2::first_type&
849 operator()(_Pair2& __x)
const
850 {
return __x.first; }
852 template<
typename _Pair2>
853 const typename _Pair2::first_type&
854 operator()(
const _Pair2& __x)
const
855 {
return __x.first; }
859 template<
typename _Pair>
861 :
public unary_function<_Pair, typename _Pair::second_type>
863 typename _Pair::second_type&
864 operator()(_Pair& __x)
const
865 {
return __x.second; }
867 const typename _Pair::second_type&
868 operator()(
const _Pair& __x)
const
869 {
return __x.second; }
890 template<
typename _Ret,
typename _Tp>
899 operator()(_Tp* __p)
const
900 {
return (__p->*_M_f)(); }
908 template<
typename _Ret,
typename _Tp>
917 operator()(
const _Tp* __p)
const
918 {
return (__p->*_M_f)(); }
921 _Ret (_Tp::*_M_f)()
const;
926 template<
typename _Ret,
typename _Tp>
935 operator()(_Tp& __r)
const
936 {
return (__r.*_M_f)(); }
944 template<
typename _Ret,
typename _Tp>
953 operator()(
const _Tp& __r)
const
954 {
return (__r.*_M_f)(); }
957 _Ret (_Tp::*_M_f)()
const;
962 template<
typename _Ret,
typename _Tp,
typename _Arg>
971 operator()(_Tp* __p, _Arg __x)
const
972 {
return (__p->*_M_f)(__x); }
975 _Ret (_Tp::*_M_f)(_Arg);
980 template<
typename _Ret,
typename _Tp,
typename _Arg>
989 operator()(
const _Tp* __p, _Arg __x)
const
990 {
return (__p->*_M_f)(__x); }
993 _Ret (_Tp::*_M_f)(_Arg)
const;
998 template<
typename _Ret,
typename _Tp,
typename _Arg>
1007 operator()(_Tp& __r, _Arg __x)
const
1008 {
return (__r.*_M_f)(__x); }
1011 _Ret (_Tp::*_M_f)(_Arg);
1016 template<
typename _Ret,
typename _Tp,
typename _Arg>
1025 operator()(
const _Tp& __r, _Arg __x)
const
1026 {
return (__r.*_M_f)(__x); }
1029 _Ret (_Tp::*_M_f)(_Arg)
const;
1034 template<
typename _Ret,
typename _Tp>
1036 mem_fun(_Ret (_Tp::*__f)())
1039 template<
typename _Ret,
typename _Tp>
1040 inline const_mem_fun_t<_Ret, _Tp>
1041 mem_fun(_Ret (_Tp::*__f)()
const)
1042 {
return const_mem_fun_t<_Ret, _Tp>(__f); }
1044 template<
typename _Ret,
typename _Tp>
1045 inline mem_fun_ref_t<_Ret, _Tp>
1046 mem_fun_ref(_Ret (_Tp::*__f)())
1047 {
return mem_fun_ref_t<_Ret, _Tp>(__f); }
1049 template<
typename _Ret,
typename _Tp>
1050 inline const_mem_fun_ref_t<_Ret, _Tp>
1051 mem_fun_ref(_Ret (_Tp::*__f)()
const)
1052 {
return const_mem_fun_ref_t<_Ret, _Tp>(__f); }
1054 template<
typename _Ret,
typename _Tp,
typename _Arg>
1055 inline mem_fun1_t<_Ret, _Tp, _Arg>
1056 mem_fun(_Ret (_Tp::*__f)(_Arg))
1057 {
return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
1059 template<
typename _Ret,
typename _Tp,
typename _Arg>
1060 inline const_mem_fun1_t<_Ret, _Tp, _Arg>
1061 mem_fun(_Ret (_Tp::*__f)(_Arg)
const)
1062 {
return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
1064 template<
typename _Ret,
typename _Tp,
typename _Arg>
1065 inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
1066 mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
1067 {
return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
1069 template<
typename _Ret,
typename _Tp,
typename _Arg>
1070 inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
1071 mem_fun_ref(_Ret (_Tp::*__f)(_Arg)
const)
1072 {
return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
1076 _GLIBCXX_END_NAMESPACE_VERSION
1079 #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED
One of the Boolean operations functors.
One of the Boolean operations functors.
One of the adaptors for function pointers.
One of the math functors.
One of the comparison functors.
unary_negate< _Predicate > not1(const _Predicate &__pred)
One of the negation functors.
binary_negate< _Predicate > not2(const _Predicate &__pred)
One of the negation functors.
One of the adaptors for member pointers.
One of the math functors.
One of the math functors.
One of the Boolean operations functors.
One of the adaptors for member pointers.
One of the negation functors.
_Result result_type
result_type is the return type
One of the math functors.
_Arg1 first_argument_type
first_argument_type is the type of the first argument
One of the comparison functors.
One of the comparison functors.
One of the adaptors for member pointers.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
_Arg argument_type
argument_type is the type of the argument
One of the negation functors.
One of the comparison functors.
One of the comparison functors.
_Result result_type
result_type is the return type
One of the adaptors for member pointers.
One of the adaptors for member pointers.
One of the math 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 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.
One of the adaptors for member pointers.
One of the math functors.