56#ifndef _STL_FUNCTION_H
57#define _STL_FUNCTION_H 1
59#if __cplusplus > 201103L
63namespace std _GLIBCXX_VISIBILITY(default)
65_GLIBCXX_BEGIN_NAMESPACE_VERSION
116 template<
typename _Arg,
typename _Result>
124 } _GLIBCXX11_DEPRECATED;
130 template<
typename _Arg1,
typename _Arg2,
typename _Result>
141 } _GLIBCXX11_DEPRECATED;
156#if __glibcxx_transparent_operators
159 template<
typename _Tp =
void>
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>
179#pragma GCC diagnostic push
180#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
183 template<
typename _Tp>
190 {
return __x + __y; }
194 template<
typename _Tp>
199 operator()(
const _Tp& __x,
const _Tp& __y)
const
200 {
return __x - __y; }
204 template<
typename _Tp>
209 operator()(
const _Tp& __x,
const _Tp& __y)
const
210 {
return __x * __y; }
214 template<
typename _Tp>
219 operator()(
const _Tp& __x,
const _Tp& __y)
const
220 {
return __x / __y; }
224 template<
typename _Tp>
229 operator()(
const _Tp& __x,
const _Tp& __y)
const
230 {
return __x % __y; }
234 template<
typename _Tp>
239 operator()(
const _Tp& __x)
const
242#pragma GCC diagnostic pop
244#ifdef __glibcxx_transparent_operators
248 template <
typename _Tp,
typename _Up>
256 typedef __is_transparent is_transparent;
263 template <
typename _Tp,
typename _Up>
266 operator()(_Tp&& __t, _Up&&
__u)
const
278 template <
typename _Tp,
typename _Up>
281 operator()(_Tp&& __t, _Up&&
__u)
const
293 template <
typename _Tp,
typename _Up>
296 operator()(_Tp&& __t, _Up&&
__u)
const
308 template <
typename _Tp,
typename _Up>
311 operator()(_Tp&& __t, _Up&&
__u)
const
323 template <
typename _Tp>
326 operator()(_Tp&& __t)
const
345#if __glibcxx_transparent_operators
346 template<
typename _Tp =
void>
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>
365#pragma GCC diagnostic push
366#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
369 template<
typename _Tp>
374 operator()(
const _Tp& __x,
const _Tp& __y)
const
375 {
return __x == __y; }
379 template<
typename _Tp>
384 operator()(
const _Tp& __x,
const _Tp& __y)
const
385 {
return __x != __y; }
389 template<
typename _Tp>
394 operator()(
const _Tp& __x,
const _Tp& __y)
const
395 {
return __x > __y; }
399 template<
typename _Tp>
404 operator()(
const _Tp& __x,
const _Tp& __y)
const
405 {
return __x < __y; }
409 template<
typename _Tp>
414 operator()(
const _Tp& __x,
const _Tp& __y)
const
415 {
return __x >= __y; }
419 template<
typename _Tp>
424 operator()(
const _Tp& __x,
const _Tp& __y)
const
425 {
return __x <= __y; }
429 template<
typename _Tp>
435#if __cplusplus >= 201402L
436 if (std::__is_constant_evaluated())
439 return (__UINTPTR_TYPE__)__x > (__UINTPTR_TYPE__)__y;
444 template<
typename _Tp>
445 struct less<_Tp*> :
public binary_function<_Tp*, _Tp*, bool>
447 _GLIBCXX14_CONSTEXPR
bool
448 operator()(_Tp* __x, _Tp* __y)
const _GLIBCXX_NOTHROW
450#if __cplusplus >= 201402L
451 if (std::__is_constant_evaluated())
454 return (__UINTPTR_TYPE__)__x < (__UINTPTR_TYPE__)__y;
459 template<
typename _Tp>
460 struct greater_equal<_Tp*> :
public binary_function<_Tp*, _Tp*, bool>
462 _GLIBCXX14_CONSTEXPR
bool
463 operator()(_Tp* __x, _Tp* __y)
const _GLIBCXX_NOTHROW
465#if __cplusplus >= 201402L
466 if (std::__is_constant_evaluated())
469 return (__UINTPTR_TYPE__)__x >= (__UINTPTR_TYPE__)__y;
474 template<
typename _Tp>
475 struct less_equal<_Tp*> :
public binary_function<_Tp*, _Tp*, bool>
477 _GLIBCXX14_CONSTEXPR
bool
478 operator()(_Tp* __x, _Tp* __y)
const _GLIBCXX_NOTHROW
480#if __cplusplus >= 201402L
481 if (std::__is_constant_evaluated())
484 return (__UINTPTR_TYPE__)__x <= (__UINTPTR_TYPE__)__y;
487#pragma GCC diagnostic pop
489#ifdef __glibcxx_transparent_operators
494 template <
typename _Tp,
typename _Up>
496 operator()(_Tp&& __t, _Up&&
__u)
const
508 template <
typename _Tp,
typename _Up>
510 operator()(_Tp&& __t, _Up&&
__u)
const
522 template <
typename _Tp,
typename _Up>
524 operator()(_Tp&& __t, _Up&&
__u)
const
532 template<
typename _Tp,
typename _Up>
534 operator()(_Tp* __t, _Up*
__u)
const noexcept
540 template <
typename _Tp,
typename _Up>
541 static constexpr decltype(
auto)
545 template <
typename _Tp,
typename _Up>
546 static constexpr bool
555 template<
typename _Tp,
typename _Up,
typename =
void>
559 template<
typename _Tp,
typename _Up>
565 template<
typename _Tp,
typename _Up,
typename =
void>
569 template<
typename _Tp,
typename _Up>
574 template<
typename _Tp,
typename _Up>
584 template <
typename _Tp,
typename _Up>
586 operator()(_Tp&& __t, _Up&&
__u)
const
594 template<
typename _Tp,
typename _Up>
596 operator()(_Tp* __t, _Up*
__u)
const noexcept
602 template <
typename _Tp,
typename _Up>
603 static constexpr decltype(
auto)
607 template <
typename _Tp,
typename _Up>
608 static constexpr bool
617 template<
typename _Tp,
typename _Up,
typename =
void>
621 template<
typename _Tp,
typename _Up>
627 template<
typename _Tp,
typename _Up,
typename =
void>
631 template<
typename _Tp,
typename _Up>
636 template<
typename _Tp,
typename _Up>
646 template <
typename _Tp,
typename _Up>
648 operator()(_Tp&& __t, _Up&&
__u)
const
656 template<
typename _Tp,
typename _Up>
658 operator()(_Tp* __t, _Up*
__u)
const noexcept
664 template <
typename _Tp,
typename _Up>
665 static constexpr decltype(
auto)
669 template <
typename _Tp,
typename _Up>
670 static constexpr bool
679 template<
typename _Tp,
typename _Up,
typename =
void>
683 template<
typename _Tp,
typename _Up>
689 template<
typename _Tp,
typename _Up,
typename =
void>
693 template<
typename _Tp,
typename _Up>
698 template<
typename _Tp,
typename _Up>
708 template <
typename _Tp,
typename _Up>
710 operator()(_Tp&& __t, _Up&&
__u)
const
718 template<
typename _Tp,
typename _Up>
720 operator()(_Tp* __t, _Up*
__u)
const noexcept
726 template <
typename _Tp,
typename _Up>
727 static constexpr decltype(
auto)
731 template <
typename _Tp,
typename _Up>
732 static constexpr bool
741 template<
typename _Tp,
typename _Up,
typename =
void>
745 template<
typename _Tp,
typename _Up>
751 template<
typename _Tp,
typename _Up,
typename =
void>
755 template<
typename _Tp,
typename _Up>
760 template<
typename _Tp,
typename _Up>
777#ifdef __glibcxx_transparent_operators
778 template<
typename _Tp =
void>
781 template<
typename _Tp =
void>
784 template<
typename _Tp =
void>
788#pragma GCC diagnostic push
789#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
792 template<
typename _Tp>
797 operator()(
const _Tp& __x,
const _Tp& __y)
const
798 {
return __x && __y; }
802 template<
typename _Tp>
807 operator()(
const _Tp& __x,
const _Tp& __y)
const
808 {
return __x || __y; }
812 template<
typename _Tp>
817 operator()(
const _Tp& __x)
const
820#pragma GCC diagnostic pop
822#ifdef __glibcxx_transparent_operators
827 template <
typename _Tp,
typename _Up>
830 operator()(_Tp&& __t, _Up&&
__u)
const
842 template <
typename _Tp,
typename _Up>
845 operator()(_Tp&& __t, _Up&&
__u)
const
857 template <
typename _Tp>
860 operator()(_Tp&& __t)
const
870#ifdef __glibcxx_transparent_operators
871 template<
typename _Tp =
void>
874 template<
typename _Tp =
void>
877 template<
typename _Tp =
void>
880 template<
typename _Tp =
void>
884#pragma GCC diagnostic push
885#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
889 template<
typename _Tp>
894 operator()(
const _Tp& __x,
const _Tp& __y)
const
895 {
return __x & __y; }
898 template<
typename _Tp>
899 struct bit_or :
public binary_function<_Tp, _Tp, _Tp>
903 operator()(
const _Tp& __x,
const _Tp& __y)
const
904 {
return __x | __y; }
907 template<
typename _Tp>
908 struct bit_xor :
public binary_function<_Tp, _Tp, _Tp>
912 operator()(
const _Tp& __x,
const _Tp& __y)
const
913 {
return __x ^ __y; }
916 template<
typename _Tp>
917 struct bit_not :
public unary_function<_Tp, _Tp>
921 operator()(
const _Tp& __x)
const
924#pragma GCC diagnostic pop
926#ifdef __glibcxx_transparent_operators
930 template <
typename _Tp,
typename _Up>
933 operator()(_Tp&& __t, _Up&& __u)
const
938 typedef __is_transparent is_transparent;
944 template <
typename _Tp,
typename _Up>
947 operator()(_Tp&& __t, _Up&& __u)
const
952 typedef __is_transparent is_transparent;
958 template <
typename _Tp,
typename _Up>
961 operator()(_Tp&& __t, _Up&& __u)
const
966 typedef __is_transparent is_transparent;
972 template <
typename _Tp>
975 operator()(_Tp&& __t)
const
976 noexcept(
noexcept(
~std::forward<_Tp>(__t)))
977 ->
decltype(
~std::forward<_Tp>(__t))
978 {
return ~std::forward<_Tp>(__t); }
980 typedef __is_transparent is_transparent;
984#pragma GCC diagnostic push
985#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1020 template<
typename _Predicate>
1022 :
public unary_function<typename _Predicate::argument_type, bool>
1034 operator()(
const typename _Predicate::argument_type& __x)
const
1035 {
return !_M_pred(__x); }
1039 template<
typename _Predicate>
1040 _GLIBCXX17_DEPRECATED_SUGGEST(
"std::not_fn")
1047 template<
typename _Predicate>
1050 typename _Predicate::second_argument_type, bool>
1062 operator()(
const typename _Predicate::first_argument_type& __x,
1063 const typename _Predicate::second_argument_type& __y)
const
1064 {
return !_M_pred(__x, __y); }
1068 template<
typename _Predicate>
1069 _GLIBCXX17_DEPRECATED_SUGGEST(
"std::not_fn")
1101 template<
typename _Arg,
typename _Result>
1105 _Result (*_M_ptr)(_Arg);
1115 operator()(_Arg __x)
const
1116 {
return _M_ptr(__x); }
1117 } _GLIBCXX11_DEPRECATED;
1120 template<
typename _Arg,
typename _Result>
1121 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::function")
1127 template<
typename _Arg1,
typename _Arg2,
typename _Result>
1143 {
return _M_ptr(__x, __y); }
1144 } _GLIBCXX11_DEPRECATED;
1147 template<
typename _Arg1,
typename _Arg2,
typename _Result>
1148 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::function")
1154 template<
typename _Tp>
1156 :
public unary_function<_Tp, _Tp>
1159 operator()(_Tp& __x)
const
1163 operator()(
const _Tp& __x)
const
1168 template<
typename _Tp>
struct _Identity<const _Tp> : _Identity<_Tp> { };
1170 template<
typename _Pair>
1172 :
public unary_function<_Pair, typename _Pair::first_type>
1174 typename _Pair::first_type&
1175 operator()(_Pair& __x)
const
1176 {
return __x.first; }
1178 const typename _Pair::first_type&
1179 operator()(
const _Pair& __x)
const
1180 {
return __x.first; }
1182#if __cplusplus >= 201103L
1183 template<
typename _Pair2>
1184 typename _Pair2::first_type&
1185 operator()(_Pair2& __x)
const
1186 {
return __x.first; }
1188 template<
typename _Pair2>
1189 const typename _Pair2::first_type&
1190 operator()(
const _Pair2& __x)
const
1191 {
return __x.first; }
1195 template<
typename _Pair>
1197 :
public unary_function<_Pair, typename _Pair::second_type>
1199 typename _Pair::second_type&
1200 operator()(_Pair& __x)
const
1201 {
return __x.second; }
1203 const typename _Pair::second_type&
1204 operator()(
const _Pair& __x)
const
1205 {
return __x.second; }
1228 template<
typename _Ret,
typename _Tp>
1237 operator()(_Tp* __p)
const
1238 {
return (__p->*_M_f)(); }
1241 _Ret (_Tp::*_M_f)();
1242 } _GLIBCXX11_DEPRECATED;
1245 template<
typename _Ret,
typename _Tp>
1254 operator()(
const _Tp* __p)
const
1255 {
return (__p->*_M_f)(); }
1258 _Ret (_Tp::*_M_f)()
const;
1259 } _GLIBCXX11_DEPRECATED;
1262 template<
typename _Ret,
typename _Tp>
1271 operator()(_Tp& __r)
const
1272 {
return (__r.*_M_f)(); }
1275 _Ret (_Tp::*_M_f)();
1276 } _GLIBCXX11_DEPRECATED;
1279 template<
typename _Ret,
typename _Tp>
1288 operator()(
const _Tp& __r)
const
1289 {
return (__r.*_M_f)(); }
1292 _Ret (_Tp::*_M_f)()
const;
1293 } _GLIBCXX11_DEPRECATED;
1296 template<
typename _Ret,
typename _Tp,
typename _Arg>
1305 operator()(_Tp* __p, _Arg __x)
const
1306 {
return (__p->*_M_f)(__x); }
1309 _Ret (_Tp::*_M_f)(_Arg);
1310 } _GLIBCXX11_DEPRECATED;
1313 template<
typename _Ret,
typename _Tp,
typename _Arg>
1322 operator()(
const _Tp* __p, _Arg __x)
const
1323 {
return (__p->*_M_f)(__x); }
1326 _Ret (_Tp::*_M_f)(_Arg)
const;
1327 } _GLIBCXX11_DEPRECATED;
1330 template<
typename _Ret,
typename _Tp,
typename _Arg>
1339 operator()(_Tp& __r, _Arg __x)
const
1340 {
return (__r.*_M_f)(__x); }
1343 _Ret (_Tp::*_M_f)(_Arg);
1344 } _GLIBCXX11_DEPRECATED;
1347 template<
typename _Ret,
typename _Tp,
typename _Arg>
1356 operator()(
const _Tp& __r, _Arg __x)
const
1357 {
return (__r.*_M_f)(__x); }
1360 _Ret (_Tp::*_M_f)(_Arg)
const;
1361 } _GLIBCXX11_DEPRECATED;
1365 template<
typename _Ret,
typename _Tp>
1366 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1368 mem_fun(_Ret (_Tp::*__f)())
1371 template<
typename _Ret,
typename _Tp>
1372 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1373 inline const_mem_fun_t<_Ret, _Tp>
1374 mem_fun(_Ret (_Tp::*__f)() const)
1375 {
return const_mem_fun_t<_Ret, _Tp>(__f); }
1377 template<
typename _Ret,
typename _Tp>
1378 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1379 inline mem_fun_ref_t<_Ret, _Tp>
1380 mem_fun_ref(_Ret (_Tp::*__f)())
1381 {
return mem_fun_ref_t<_Ret, _Tp>(__f); }
1383 template<
typename _Ret,
typename _Tp>
1384 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1385 inline const_mem_fun_ref_t<_Ret, _Tp>
1386 mem_fun_ref(_Ret (_Tp::*__f)() const)
1387 {
return const_mem_fun_ref_t<_Ret, _Tp>(__f); }
1389 template<
typename _Ret,
typename _Tp,
typename _Arg>
1390 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1391 inline mem_fun1_t<_Ret, _Tp, _Arg>
1392 mem_fun(_Ret (_Tp::*__f)(_Arg))
1393 {
return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
1395 template<
typename _Ret,
typename _Tp,
typename _Arg>
1396 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1397 inline const_mem_fun1_t<_Ret, _Tp, _Arg>
1398 mem_fun(_Ret (_Tp::*__f)(_Arg) const)
1399 {
return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
1401 template<
typename _Ret,
typename _Tp,
typename _Arg>
1402 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1403 inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
1404 mem_fun_ref(_Ret (_Tp::*__f)(_Arg))
1405 {
return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
1407 template<
typename _Ret,
typename _Tp,
typename _Arg>
1408 _GLIBCXX11_DEPRECATED_SUGGEST(
"std::mem_fn")
1409 inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
1410 mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)
1411 {
return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
1412#pragma GCC diagnostic pop
1416#ifdef __glibcxx_transparent_operators
1417 template<
typename _Func,
typename _SfinaeType,
typename = __
void_t<>>
1418 struct __has_is_transparent
1421 template<
typename _Func,
typename _SfinaeType>
1422 struct __has_is_transparent<_Func, _SfinaeType,
1423 __void_t<typename _Func::is_transparent>>
1424 {
typedef void type; };
1426 template<
typename _Func,
typename _SfinaeType>
1427 using __has_is_transparent_t
1428 =
typename __has_is_transparent<_Func, _SfinaeType>::type;
1431_GLIBCXX_END_NAMESPACE_VERSION
1434#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.