56#ifndef _STL_FUNCTION_H
57#define _STL_FUNCTION_H 1
59#if __cplusplus > 201103L
62#if __cplusplus >= 202002L
66namespace std _GLIBCXX_VISIBILITY(default)
68_GLIBCXX_BEGIN_NAMESPACE_VERSION
119 template<
typename _Arg,
typename _Result>
127 } _GLIBCXX11_DEPRECATED;
133 template<
typename _Arg1,
typename _Arg2,
typename _Result>
144 } _GLIBCXX11_DEPRECATED;
159#if __glibcxx_transparent_operators
162 template<
typename _Tp =
void>
165 template<
typename _Tp =
void>
168 template<
typename _Tp =
void>
171 template<
typename _Tp =
void>
174 template<
typename _Tp =
void>
177 template<
typename _Tp =
void>
182#pragma GCC diagnostic push
183#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
186 template<
typename _Tp>
193 {
return __x + __y; }
197 template<
typename _Tp>
202 operator()(
const _Tp& __x,
const _Tp& __y)
const
203 {
return __x - __y; }
207 template<
typename _Tp>
212 operator()(
const _Tp& __x,
const _Tp& __y)
const
213 {
return __x * __y; }
217 template<
typename _Tp>
222 operator()(
const _Tp& __x,
const _Tp& __y)
const
223 {
return __x / __y; }
227 template<
typename _Tp>
232 operator()(
const _Tp& __x,
const _Tp& __y)
const
233 {
return __x % __y; }
237 template<
typename _Tp>
242 operator()(
const _Tp& __x)
const
245#pragma GCC diagnostic pop
247#ifdef __glibcxx_transparent_operators
251 template <
typename _Tp,
typename _Up>
259 typedef __is_transparent is_transparent;
266 template <
typename _Tp,
typename _Up>
269 operator()(_Tp&& __t, _Up&&
__u)
const
281 template <
typename _Tp,
typename _Up>
284 operator()(_Tp&& __t, _Up&&
__u)
const
296 template <
typename _Tp,
typename _Up>
299 operator()(_Tp&& __t, _Up&&
__u)
const
311 template <
typename _Tp,
typename _Up>
314 operator()(_Tp&& __t, _Up&&
__u)
const
326 template <
typename _Tp>
329 operator()(_Tp&& __t)
const
348#if __glibcxx_transparent_operators
349 template<
typename _Tp =
void>
352 template<
typename _Tp =
void>
355 template<
typename _Tp =
void>
358 template<
typename _Tp =
void>
361 template<
typename _Tp =
void>
364 template<
typename _Tp =
void>
368#pragma GCC diagnostic push
369#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
372 template<
typename _Tp>
377 operator()(
const _Tp& __x,
const _Tp& __y)
const
378 {
return __x == __y; }
382 template<
typename _Tp>
387 operator()(
const _Tp& __x,
const _Tp& __y)
const
388 {
return __x != __y; }
392 template<
typename _Tp>
397 operator()(
const _Tp& __x,
const _Tp& __y)
const
398 {
return __x > __y; }
402 template<
typename _Tp>
407 operator()(
const _Tp& __x,
const _Tp& __y)
const
408 {
return __x < __y; }
412 template<
typename _Tp>
417 operator()(
const _Tp& __x,
const _Tp& __y)
const
418 {
return __x >= __y; }
422 template<
typename _Tp>
427 operator()(
const _Tp& __x,
const _Tp& __y)
const
428 {
return __x <= __y; }
432 template<
typename _Tp>
438#if __cplusplus >= 201402L
439 if (std::__is_constant_evaluated())
442 return (__UINTPTR_TYPE__)__x > (__UINTPTR_TYPE__)__y;
447 template<
typename _Tp>
448 struct less<_Tp*> :
public binary_function<_Tp*, _Tp*, bool>
450 _GLIBCXX14_CONSTEXPR
bool
451 operator()(_Tp* __x, _Tp* __y)
const _GLIBCXX_NOTHROW
453#if __cplusplus >= 201402L
454 if (std::__is_constant_evaluated())
457 return (__UINTPTR_TYPE__)__x < (__UINTPTR_TYPE__)__y;
462 template<
typename _Tp>
463 struct greater_equal<_Tp*> :
public binary_function<_Tp*, _Tp*, bool>
465 _GLIBCXX14_CONSTEXPR
bool
466 operator()(_Tp* __x, _Tp* __y)
const _GLIBCXX_NOTHROW
468#if __cplusplus >= 201402L
469 if (std::__is_constant_evaluated())
472 return (__UINTPTR_TYPE__)__x >= (__UINTPTR_TYPE__)__y;
477 template<
typename _Tp>
478 struct less_equal<_Tp*> :
public binary_function<_Tp*, _Tp*, bool>
480 _GLIBCXX14_CONSTEXPR
bool
481 operator()(_Tp* __x, _Tp* __y)
const _GLIBCXX_NOTHROW
483#if __cplusplus >= 201402L
484 if (std::__is_constant_evaluated())
487 return (__UINTPTR_TYPE__)__x <= (__UINTPTR_TYPE__)__y;
490#pragma GCC diagnostic pop
492#ifdef __glibcxx_transparent_operators
497 template <
typename _Tp,
typename _Up>
499 operator()(_Tp&& __t, _Up&&
__u)
const
511 template <
typename _Tp,
typename _Up>
513 operator()(_Tp&& __t, _Up&&
__u)
const
525 template <
typename _Tp,
typename _Up>
527 operator()(_Tp&& __t, _Up&&
__u)
const
531#pragma GCC diagnostic push
532#pragma GCC diagnostic ignored "-Wc++17-extensions"
539#pragma GCC diagnostic pop
542 template<
typename _Tp,
typename _Up>
544 operator()(_Tp* __t, _Up*
__u)
const noexcept
550#if __cplusplus >= 202002L
551 template<
typename _Tp,
typename _Up>
552 static constexpr bool __ptr_cmp =
requires
559 && __detail::__not_overloaded_spaceship<_Tp, _Up>
565 template<
typename _Tp,
typename _Up,
typename =
void>
569 template<
typename _Tp,
typename _Up>
575 template<
typename _Tp,
typename _Up,
typename =
void>
579 template<
typename _Tp,
typename _Up>
584 template<
typename _Tp,
typename _Up>
585 static constexpr bool __ptr_cmp = __and_<
596 template <
typename _Tp,
typename _Up>
598 operator()(_Tp&& __t, _Up&&
__u)
const
602#pragma GCC diagnostic push
603#pragma GCC diagnostic ignored "-Wc++17-extensions"
610#pragma GCC diagnostic pop
613 template<
typename _Tp,
typename _Up>
615 operator()(_Tp* __t, _Up*
__u)
const noexcept
621#if __cplusplus >= 202002L
622 template<
typename _Tp,
typename _Up>
623 static constexpr bool __ptr_cmp =
requires
630 && __detail::__not_overloaded_spaceship<_Tp, _Up>
636 template<
typename _Tp,
typename _Up,
typename =
void>
640 template<
typename _Tp,
typename _Up>
646 template<
typename _Tp,
typename _Up,
typename =
void>
650 template<
typename _Tp,
typename _Up>
655 template<
typename _Tp,
typename _Up>
656 static constexpr bool __ptr_cmp = __and_<
667 template <
typename _Tp,
typename _Up>
669 operator()(_Tp&& __t, _Up&&
__u)
const
673#pragma GCC diagnostic push
674#pragma GCC diagnostic ignored "-Wc++17-extensions"
681#pragma GCC diagnostic pop
684 template<
typename _Tp,
typename _Up>
686 operator()(_Tp* __t, _Up*
__u)
const noexcept
692#if __cplusplus >= 202002L
693 template<
typename _Tp,
typename _Up>
694 static constexpr bool __ptr_cmp =
requires
701 && __detail::__not_overloaded_spaceship<_Tp, _Up>
707 template<
typename _Tp,
typename _Up,
typename =
void>
711 template<
typename _Tp,
typename _Up>
717 template<
typename _Tp,
typename _Up,
typename =
void>
721 template<
typename _Tp,
typename _Up>
726 template<
typename _Tp,
typename _Up>
727 static constexpr bool __ptr_cmp = __and_<
738 template <
typename _Tp,
typename _Up>
740 operator()(_Tp&& __t, _Up&&
__u)
const
744#pragma GCC diagnostic push
745#pragma GCC diagnostic ignored "-Wc++17-extensions"
752#pragma GCC diagnostic pop
755 template<
typename _Tp,
typename _Up>
757 operator()(_Tp* __t, _Up*
__u)
const noexcept
763#if __cplusplus >= 202002L
764 template<
typename _Tp,
typename _Up>
765 static constexpr bool __ptr_cmp =
requires
772 && __detail::__not_overloaded_spaceship<_Tp, _Up>
778 template<
typename _Tp,
typename _Up,
typename =
void>
782 template<
typename _Tp,
typename _Up>
788 template<
typename _Tp,
typename _Up,
typename =
void>
792 template<
typename _Tp,
typename _Up>
797 template<
typename _Tp,
typename _Up>
798 static constexpr bool __ptr_cmp = __and_<
816#ifdef __glibcxx_transparent_operators
817 template<
typename _Tp =
void>
820 template<
typename _Tp =
void>
823 template<
typename _Tp =
void>
827#pragma GCC diagnostic push
828#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
831 template<
typename _Tp>
836 operator()(
const _Tp& __x,
const _Tp& __y)
const
837 {
return __x && __y; }
841 template<
typename _Tp>
846 operator()(
const _Tp& __x,
const _Tp& __y)
const
847 {
return __x || __y; }
851 template<
typename _Tp>
856 operator()(
const _Tp& __x)
const
859#pragma GCC diagnostic pop
861#ifdef __glibcxx_transparent_operators
866 template <
typename _Tp,
typename _Up>
869 operator()(_Tp&& __t, _Up&&
__u)
const
881 template <
typename _Tp,
typename _Up>
884 operator()(_Tp&& __t, _Up&&
__u)
const
896 template <
typename _Tp>
899 operator()(_Tp&& __t)
const
909#ifdef __glibcxx_transparent_operators
910 template<
typename _Tp =
void>
913 template<
typename _Tp =
void>
916 template<
typename _Tp =
void>
919 template<
typename _Tp =
void>
923#pragma GCC diagnostic push
924#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
928 template<
typename _Tp>
933 operator()(
const _Tp& __x,
const _Tp& __y)
const
934 {
return __x & __y; }
937 template<
typename _Tp>
938 struct bit_or :
public binary_function<_Tp, _Tp, _Tp>
942 operator()(
const _Tp& __x,
const _Tp& __y)
const
943 {
return __x | __y; }
946 template<
typename _Tp>
947 struct bit_xor :
public binary_function<_Tp, _Tp, _Tp>
951 operator()(
const _Tp& __x,
const _Tp& __y)
const
952 {
return __x ^ __y; }
955 template<
typename _Tp>
956 struct bit_not :
public unary_function<_Tp, _Tp>
960 operator()(
const _Tp& __x)
const
963#pragma GCC diagnostic pop
965#ifdef __glibcxx_transparent_operators
969 template <
typename _Tp,
typename _Up>
972 operator()(_Tp&& __t, _Up&& __u)
const
977 typedef __is_transparent is_transparent;
983 template <
typename _Tp,
typename _Up>
986 operator()(_Tp&& __t, _Up&& __u)
const
991 typedef __is_transparent is_transparent;
997 template <
typename _Tp,
typename _Up>
1000 operator()(_Tp&& __t, _Up&& __u)
const
1005 typedef __is_transparent is_transparent;
1009 struct bit_not<void>
1011 template <
typename _Tp>
1012 _GLIBCXX14_CONSTEXPR
1014 operator()(_Tp&& __t)
const
1015 noexcept(
noexcept(
~std::forward<_Tp>(__t)))
1016 ->
decltype(
~std::forward<_Tp>(__t))
1017 {
return ~std::forward<_Tp>(__t); }
1019 typedef __is_transparent is_transparent;
1023#pragma GCC diagnostic push
1024#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1059 template<
typename _Predicate>
1061 :
public unary_function<typename _Predicate::argument_type, bool>
1073 operator()(
const typename _Predicate::argument_type& __x)
const
1074 {
return !_M_pred(__x); }
1078 template<
typename _Predicate>
1079 _GLIBCXX17_DEPRECATED_SUGGEST(
"std::not_fn")
1086 template<
typename _Predicate>
1089 typename _Predicate::second_argument_type, bool>
1101 operator()(
const typename _Predicate::first_argument_type& __x,
1102 const typename _Predicate::second_argument_type& __y)
const
1103 {
return !_M_pred(__x, __y); }
1107 template<
typename _Predicate>
1108 _GLIBCXX17_DEPRECATED_SUGGEST(
"std::not_fn")
1140 template<
typename _Arg,
typename _Result>
1144 _Result (*_M_ptr)(_Arg);
1154 operator()(_Arg __x)
const
1155 {
return _M_ptr(__x); }
1156 } _GLIBCXX11_DEPRECATED;
1159 template<
typename _Arg,
typename _Result>
1160 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::function")
1166 template<
typename _Arg1,
typename _Arg2,
typename _Result>
1182 {
return _M_ptr(__x, __y); }
1183 } _GLIBCXX11_DEPRECATED;
1186 template<
typename _Arg1,
typename _Arg2,
typename _Result>
1187 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::function")
1193 template<
typename _Tp>
1195 :
public unary_function<_Tp, _Tp>
1198 operator()(_Tp& __x)
const
1202 operator()(
const _Tp& __x)
const
1207 template<
typename _Tp>
struct _Identity<const _Tp> : _Identity<_Tp> { };
1209 template<
typename _Pair>
1211 :
public unary_function<_Pair, typename _Pair::first_type>
1213 typename _Pair::first_type&
1214 operator()(_Pair& __x)
const
1215 {
return __x.first; }
1217 const typename _Pair::first_type&
1218 operator()(
const _Pair& __x)
const
1219 {
return __x.first; }
1221#if __cplusplus >= 201103L
1222 template<
typename _Pair2>
1223 typename _Pair2::first_type&
1224 operator()(_Pair2& __x)
const
1225 {
return __x.first; }
1227 template<
typename _Pair2>
1228 const typename _Pair2::first_type&
1229 operator()(
const _Pair2& __x)
const
1230 {
return __x.first; }
1234 template<
typename _Pair>
1236 :
public unary_function<_Pair, typename _Pair::second_type>
1238 typename _Pair::second_type&
1239 operator()(_Pair& __x)
const
1240 {
return __x.second; }
1242 const typename _Pair::second_type&
1243 operator()(
const _Pair& __x)
const
1244 {
return __x.second; }
1267 template<
typename _Ret,
typename _Tp>
1276 operator()(_Tp* __p)
const
1277 {
return (__p->*_M_f)(); }
1280 _Ret (_Tp::*_M_f)();
1281 } _GLIBCXX11_DEPRECATED;
1284 template<
typename _Ret,
typename _Tp>
1293 operator()(
const _Tp* __p)
const
1294 {
return (__p->*_M_f)(); }
1297 _Ret (_Tp::*_M_f)()
const;
1298 } _GLIBCXX11_DEPRECATED;
1301 template<
typename _Ret,
typename _Tp>
1310 operator()(_Tp& __r)
const
1311 {
return (__r.*_M_f)(); }
1314 _Ret (_Tp::*_M_f)();
1315 } _GLIBCXX11_DEPRECATED;
1318 template<
typename _Ret,
typename _Tp>
1327 operator()(
const _Tp& __r)
const
1328 {
return (__r.*_M_f)(); }
1331 _Ret (_Tp::*_M_f)()
const;
1332 } _GLIBCXX11_DEPRECATED;
1335 template<
typename _Ret,
typename _Tp,
typename _Arg>
1344 operator()(_Tp* __p, _Arg __x)
const
1345 {
return (__p->*_M_f)(__x); }
1348 _Ret (_Tp::*_M_f)(_Arg);
1349 } _GLIBCXX11_DEPRECATED;
1352 template<
typename _Ret,
typename _Tp,
typename _Arg>
1361 operator()(
const _Tp* __p, _Arg __x)
const
1362 {
return (__p->*_M_f)(__x); }
1365 _Ret (_Tp::*_M_f)(_Arg)
const;
1366 } _GLIBCXX11_DEPRECATED;
1369 template<
typename _Ret,
typename _Tp,
typename _Arg>
1378 operator()(_Tp& __r, _Arg __x)
const
1379 {
return (__r.*_M_f)(__x); }
1382 _Ret (_Tp::*_M_f)(_Arg);
1383 } _GLIBCXX11_DEPRECATED;
1386 template<
typename _Ret,
typename _Tp,
typename _Arg>
1395 operator()(
const _Tp& __r, _Arg __x)
const
1396 {
return (__r.*_M_f)(__x); }
1399 _Ret (_Tp::*_M_f)(_Arg)
const;
1400 } _GLIBCXX11_DEPRECATED;
1404 template<
typename _Ret,
typename _Tp>
1405 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1407 mem_fun(_Ret (_Tp::*__f)())
1410 template<
typename _Ret,
typename _Tp>
1411 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1412 inline const_mem_fun_t<_Ret, _Tp>
1413 mem_fun(_Ret (_Tp::*__f)() const)
1414 {
return const_mem_fun_t<_Ret, _Tp>(__f); }
1416 template<
typename _Ret,
typename _Tp>
1417 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1418 inline mem_fun_ref_t<_Ret, _Tp>
1419 mem_fun_ref(_Ret (_Tp::*__f)())
1420 {
return mem_fun_ref_t<_Ret, _Tp>(__f); }
1422 template<
typename _Ret,
typename _Tp>
1423 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1424 inline const_mem_fun_ref_t<_Ret, _Tp>
1425 mem_fun_ref(_Ret (_Tp::*__f)() const)
1426 {
return const_mem_fun_ref_t<_Ret, _Tp>(__f); }
1428 template<
typename _Ret,
typename _Tp,
typename _Arg>
1429 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1430 inline mem_fun1_t<_Ret, _Tp, _Arg>
1431 mem_fun(_Ret (_Tp::*__f)(_Arg))
1432 {
return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
1434 template<
typename _Ret,
typename _Tp,
typename _Arg>
1435 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1436 inline const_mem_fun1_t<_Ret, _Tp, _Arg>
1437 mem_fun(_Ret (_Tp::*__f)(_Arg) const)
1438 {
return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
1440 template<
typename _Ret,
typename _Tp,
typename _Arg>
1441 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1442 inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
1443 mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
1444 {
return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
1446 template<
typename _Ret,
typename _Tp,
typename _Arg>
1447 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1448 inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
1449 mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)
1450 {
return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
1451#pragma GCC diagnostic pop
1455#ifdef __glibcxx_transparent_operators
1456 template<
typename _Func,
typename _SfinaeType,
typename = __
void_t<>>
1457 struct __has_is_transparent
1460 template<
typename _Func,
typename _SfinaeType>
1461 struct __has_is_transparent<_Func, _SfinaeType,
1462 __void_t<typename _Func::is_transparent>>
1463 {
typedef void type; };
1465 template<
typename _Func,
typename _SfinaeType>
1466 using __has_is_transparent_t
1467 =
typename __has_is_transparent<_Func, _SfinaeType>::type;
1470 template<
typename _Func>
1471 concept __transparent_comparator
1472 =
requires {
typename _Func::is_transparent; };
1476_GLIBCXX_END_NAMESPACE_VERSION
1479#if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED
__bool_constant< true > true_type
The type used as a compile-time boolean with true value.
__bool_constant< false > false_type
The type used as a compile-time boolean with false value.
auto declval() noexcept -> decltype(__declval< _Tp >(0))
constexpr binary_negate< _Predicate > not2(const _Predicate &__pred)
One of the negation functors.
constexpr unary_negate< _Predicate > not1(const _Predicate &__pred)
One of the negation functors.
pointer_to_unary_function< _Arg, _Result > ptr_fun(_Result(*__x)(_Arg))
One of the adaptors for function pointers.
ISO C++ entities toplevel namespace is std.
_Arg argument_type
argument_type is the type of the argument
_Result result_type
result_type is the return type
_Result result_type
result_type is the return type
_Arg2 second_argument_type
second_argument_type is the type of the second argument
_Arg1 first_argument_type
first_argument_type is the type of the first argument
One of the math functors.
constexpr _Tp operator()(const _Tp &__x, const _Tp &__y) const
Returns the sum.
One of the math functors.
One of the math functors.
One of the math functors.
One of the math functors.
One of the math functors.
One of the comparison functors.
One of the comparison functors.
One of the comparison functors.
One of the comparison functors.
One of the comparison functors.
One of the comparison functors.
One of the Boolean operations functors.
One of the Boolean operations functors.
One of the Boolean operations functors.
One of the negation functors.
One of the negation functors.
One of the adaptors for function pointers.
One of the adaptors for function pointers.
One of the adaptors for member pointers.
One of the adaptors for member pointers.
One of the adaptors for member pointers.
One of the adaptors for member pointers.
One of the adaptors for member pointers.
One of the adaptors for member pointers.
One of the adaptors for member pointers.
One of the adaptors for member pointers.