56 #ifndef _STL_FUNCTION_H
57 #define _STL_FUNCTION_H 1
59 #if __cplusplus > 201103L
62 #if __cplusplus >= 202002L
66 namespace 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 // C++ >= 14
160 struct __is_transparent;
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>
198 struct minus :
public binary_function<_Tp, _Tp, _Tp>
202 operator()(
const _Tp& __x,
const _Tp& __y)
const
203 {
return __x - __y; }
207 template<
typename _Tp>
208 struct multiplies :
public binary_function<_Tp, _Tp, _Tp>
212 operator()(
const _Tp& __x,
const _Tp& __y)
const
213 {
return __x * __y; }
217 template<
typename _Tp>
218 struct divides :
public binary_function<_Tp, _Tp, _Tp>
222 operator()(
const _Tp& __x,
const _Tp& __y)
const
223 {
return __x / __y; }
227 template<
typename _Tp>
228 struct modulus :
public binary_function<_Tp, _Tp, _Tp>
232 operator()(
const _Tp& __x,
const _Tp& __y)
const
233 {
return __x % __y; }
237 template<
typename _Tp>
238 struct negate :
public unary_function<_Tp, _Tp>
242 operator()(
const _Tp& __x)
const
245 #pragma GCC diagnostic pop
247 #ifdef __glibcxx_transparent_operators // C++ >= 14
251 template <
typename _Tp,
typename _Up>
255 noexcept(noexcept(std::forward<_Tp>(__t) + std::forward<_Up>(__u)))
256 -> decltype(std::forward<_Tp>(__t) + std::forward<_Up>(__u))
257 {
return std::forward<_Tp>(__t) + std::forward<_Up>(__u); }
259 typedef __is_transparent is_transparent;
266 template <
typename _Tp,
typename _Up>
269 operator()(_Tp&& __t, _Up&& __u)
const
270 noexcept(noexcept(std::forward<_Tp>(__t) - std::forward<_Up>(__u)))
271 -> decltype(std::forward<_Tp>(__t) - std::forward<_Up>(__u))
272 {
return std::forward<_Tp>(__t) - std::forward<_Up>(__u); }
274 typedef __is_transparent is_transparent;
281 template <
typename _Tp,
typename _Up>
284 operator()(_Tp&& __t, _Up&& __u)
const
285 noexcept(noexcept(std::forward<_Tp>(__t) * std::forward<_Up>(__u)))
286 -> decltype(std::forward<_Tp>(__t) * std::forward<_Up>(__u))
287 {
return std::forward<_Tp>(__t) * std::forward<_Up>(__u); }
289 typedef __is_transparent is_transparent;
296 template <
typename _Tp,
typename _Up>
299 operator()(_Tp&& __t, _Up&& __u)
const
300 noexcept(noexcept(std::forward<_Tp>(__t) / std::forward<_Up>(__u)))
301 -> decltype(std::forward<_Tp>(__t) / std::forward<_Up>(__u))
302 {
return std::forward<_Tp>(__t) / std::forward<_Up>(__u); }
304 typedef __is_transparent is_transparent;
311 template <
typename _Tp,
typename _Up>
314 operator()(_Tp&& __t, _Up&& __u)
const
315 noexcept(noexcept(std::forward<_Tp>(__t) % std::forward<_Up>(__u)))
316 -> decltype(std::forward<_Tp>(__t) % std::forward<_Up>(__u))
317 {
return std::forward<_Tp>(__t) % std::forward<_Up>(__u); }
319 typedef __is_transparent is_transparent;
326 template <
typename _Tp>
329 operator()(_Tp&& __t)
const
330 noexcept(noexcept(-std::forward<_Tp>(__t)))
331 -> decltype(-std::forward<_Tp>(__t))
332 {
return -std::forward<_Tp>(__t); }
334 typedef __is_transparent is_transparent;
348 #if __glibcxx_transparent_operators // C++ >= 14
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>
383 struct not_equal_to :
public binary_function<_Tp, _Tp, bool>
387 operator()(
const _Tp& __x,
const _Tp& __y)
const
388 {
return __x != __y; }
392 template<
typename _Tp>
393 struct greater :
public binary_function<_Tp, _Tp, bool>
397 operator()(
const _Tp& __x,
const _Tp& __y)
const
398 {
return __x > __y; }
402 template<
typename _Tp>
403 struct less :
public binary_function<_Tp, _Tp, bool>
407 operator()(
const _Tp& __x,
const _Tp& __y)
const
408 {
return __x < __y; }
412 template<
typename _Tp>
413 struct greater_equal :
public binary_function<_Tp, _Tp, bool>
417 operator()(
const _Tp& __x,
const _Tp& __y)
const
418 {
return __x >= __y; }
422 template<
typename _Tp>
423 struct less_equal :
public binary_function<_Tp, _Tp, bool>
427 operator()(
const _Tp& __x,
const _Tp& __y)
const
428 {
return __x <= __y; }
432 template<
typename _Tp>
433 struct greater<_Tp*> :
public binary_function<_Tp*, _Tp*, bool>
435 _GLIBCXX14_CONSTEXPR
bool
436 operator()(_Tp* __x, _Tp* __y)
const _GLIBCXX_NOTHROW
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 // C++ >= 14
497 template <
typename _Tp,
typename _Up>
499 operator()(_Tp&& __t, _Up&& __u)
const
500 noexcept(noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u)))
501 -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u))
502 {
return std::forward<_Tp>(__t) == std::forward<_Up>(__u); }
504 typedef __is_transparent is_transparent;
511 template <
typename _Tp,
typename _Up>
513 operator()(_Tp&& __t, _Up&& __u)
const
514 noexcept(noexcept(std::forward<_Tp>(__t) != std::forward<_Up>(__u)))
515 -> decltype(std::forward<_Tp>(__t) != std::forward<_Up>(__u))
516 {
return std::forward<_Tp>(__t) != std::forward<_Up>(__u); }
518 typedef __is_transparent is_transparent;
525 template <
typename _Tp,
typename _Up>
527 operator()(_Tp&& __t, _Up&& __u)
const
528 noexcept(noexcept(std::forward<_Tp>(__t) > std::forward<_Up>(__u)))
529 -> decltype(std::forward<_Tp>(__t) > std::forward<_Up>(__u))
531 #pragma GCC diagnostic push
532 #pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr
533 if constexpr (__ptr_cmp<_Tp, _Up>)
535 static_cast<const volatile void*
>(std::forward<_Tp>(__t)),
536 static_cast<const volatile void*
>(std::forward<_Up>(__u)));
538 return std::forward<_Tp>(__t) > std::forward<_Up>(__u);
539 #pragma GCC diagnostic pop
542 template<
typename _Tp,
typename _Up>
544 operator()(_Tp* __t, _Up* __u)
const noexcept
547 typedef __is_transparent is_transparent;
550 #if __cplusplus >= 202002L
551 template<
typename _Tp,
typename _Up>
552 static constexpr
bool __ptr_cmp = requires
556 { operator>(std::declval<_Tp>(), std::declval<_Up>()); }
558 { std::declval<_Tp>().operator>(std::declval<_Up>()); }
559 && __detail::__not_overloaded_spaceship<_Tp, _Up>
560 && is_convertible_v<_Tp, const volatile void*>
561 && is_convertible_v<_Up, const volatile void*>;
565 template<
typename _Tp,
typename _Up,
typename =
void>
566 struct __not_overloaded2 :
true_type { };
569 template<
typename _Tp,
typename _Up>
570 struct __not_overloaded2<_Tp, _Up, __void_t<
571 decltype(
std::
declval<_Tp>().operator>(std::declval<_Up>()))>>
575 template<
typename _Tp,
typename _Up,
typename =
void>
576 struct __not_overloaded : __not_overloaded2<_Tp, _Up> { };
579 template<
typename _Tp,
typename _Up>
580 struct __not_overloaded<_Tp, _Up, __void_t<
584 template<
typename _Tp,
typename _Up>
585 static constexpr
bool __ptr_cmp = __and_<
586 __not_overloaded<_Tp, _Up>,
596 template <
typename _Tp,
typename _Up>
598 operator()(_Tp&& __t, _Up&& __u)
const
599 noexcept(noexcept(std::forward<_Tp>(__t) < std::forward<_Up>(__u)))
600 -> decltype(std::forward<_Tp>(__t) < std::forward<_Up>(__u))
602 #pragma GCC diagnostic push
603 #pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr
604 if constexpr (__ptr_cmp<_Tp, _Up>)
606 static_cast<const volatile void*
>(std::forward<_Tp>(__t)),
607 static_cast<const volatile void*
>(std::forward<_Up>(__u)));
609 return std::forward<_Tp>(__t) < std::forward<_Up>(__u);
610 #pragma GCC diagnostic pop
613 template<
typename _Tp,
typename _Up>
615 operator()(_Tp* __t, _Up* __u)
const noexcept
618 typedef __is_transparent is_transparent;
621 #if __cplusplus >= 202002L
622 template<
typename _Tp,
typename _Up>
623 static constexpr
bool __ptr_cmp = requires
627 { operator<(std::declval<_Tp>(), std::declval<_Up>()); }
629 { std::declval<_Tp>().operator<(std::declval<_Up>()); }
630 && __detail::__not_overloaded_spaceship<_Tp, _Up>
631 && is_convertible_v<_Tp, const volatile void*>
632 && is_convertible_v<_Up, const volatile void*>;
636 template<
typename _Tp,
typename _Up,
typename =
void>
637 struct __not_overloaded2 :
true_type { };
640 template<
typename _Tp,
typename _Up>
641 struct __not_overloaded2<_Tp, _Up, __void_t<
642 decltype(
std::
declval<_Tp>().operator<(std::declval<_Up>()))>>
646 template<
typename _Tp,
typename _Up,
typename =
void>
647 struct __not_overloaded : __not_overloaded2<_Tp, _Up> { };
650 template<
typename _Tp,
typename _Up>
651 struct __not_overloaded<_Tp, _Up, __void_t<
655 template<
typename _Tp,
typename _Up>
656 static constexpr
bool __ptr_cmp = __and_<
657 __not_overloaded<_Tp, _Up>,
667 template <
typename _Tp,
typename _Up>
669 operator()(_Tp&& __t, _Up&& __u)
const
670 noexcept(noexcept(std::forward<_Tp>(__t) >= std::forward<_Up>(__u)))
671 -> decltype(std::forward<_Tp>(__t) >= std::forward<_Up>(__u))
673 #pragma GCC diagnostic push
674 #pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr
675 if constexpr (__ptr_cmp<_Tp, _Up>)
677 static_cast<const volatile void*
>(std::forward<_Tp>(__t)),
678 static_cast<const volatile void*
>(std::forward<_Up>(__u)));
680 return std::forward<_Tp>(__t) >= std::forward<_Up>(__u);
681 #pragma GCC diagnostic pop
684 template<
typename _Tp,
typename _Up>
686 operator()(_Tp* __t, _Up* __u)
const noexcept
689 typedef __is_transparent is_transparent;
692 #if __cplusplus >= 202002L
693 template<
typename _Tp,
typename _Up>
694 static constexpr
bool __ptr_cmp = requires
698 { operator>=(std::declval<_Tp>(), std::declval<_Up>()); }
700 { std::declval<_Tp>().operator>=(std::declval<_Up>()); }
701 && __detail::__not_overloaded_spaceship<_Tp, _Up>
702 && is_convertible_v<_Tp, const volatile void*>
703 && is_convertible_v<_Up, const volatile void*>;
707 template<
typename _Tp,
typename _Up,
typename =
void>
708 struct __not_overloaded2 :
true_type { };
711 template<
typename _Tp,
typename _Up>
712 struct __not_overloaded2<_Tp, _Up, __void_t<
713 decltype(
std::
declval<_Tp>().operator>=(std::declval<_Up>()))>>
717 template<
typename _Tp,
typename _Up,
typename =
void>
718 struct __not_overloaded : __not_overloaded2<_Tp, _Up> { };
721 template<
typename _Tp,
typename _Up>
722 struct __not_overloaded<_Tp, _Up, __void_t<
723 decltype(operator>=(std::declval<_Tp>(), std::declval<_Up>()))>>
726 template<
typename _Tp,
typename _Up>
727 static constexpr
bool __ptr_cmp = __and_<
728 __not_overloaded<_Tp, _Up>,
738 template <
typename _Tp,
typename _Up>
740 operator()(_Tp&& __t, _Up&& __u)
const
741 noexcept(noexcept(std::forward<_Tp>(__t) <= std::forward<_Up>(__u)))
742 -> decltype(std::forward<_Tp>(__t) <= std::forward<_Up>(__u))
744 #pragma GCC diagnostic push
745 #pragma GCC diagnostic ignored "-Wc++17-extensions" // if constexpr
746 if constexpr (__ptr_cmp<_Tp, _Up>)
748 static_cast<const volatile void*
>(std::forward<_Tp>(__t)),
749 static_cast<const volatile void*
>(std::forward<_Up>(__u)));
751 return std::forward<_Tp>(__t) <= std::forward<_Up>(__u);
752 #pragma GCC diagnostic pop
755 template<
typename _Tp,
typename _Up>
757 operator()(_Tp* __t, _Up* __u)
const noexcept
760 typedef __is_transparent is_transparent;
763 #if __cplusplus >= 202002L
764 template<
typename _Tp,
typename _Up>
765 static constexpr
bool __ptr_cmp = requires
769 { operator<=(std::declval<_Tp>(), std::declval<_Up>()); }
771 { std::declval<_Tp>().operator<=(std::declval<_Up>()); }
772 && __detail::__not_overloaded_spaceship<_Tp, _Up>
773 && is_convertible_v<_Tp, const volatile void*>
774 && is_convertible_v<_Up, const volatile void*>;
778 template<
typename _Tp,
typename _Up,
typename =
void>
779 struct __not_overloaded2 :
true_type { };
782 template<
typename _Tp,
typename _Up>
783 struct __not_overloaded2<_Tp, _Up, __void_t<
784 decltype(
std::
declval<_Tp>().operator<=(std::declval<_Up>()))>>
788 template<
typename _Tp,
typename _Up,
typename =
void>
789 struct __not_overloaded : __not_overloaded2<_Tp, _Up> { };
792 template<
typename _Tp,
typename _Up>
793 struct __not_overloaded<_Tp, _Up, __void_t<
794 decltype(operator<=(std::declval<_Tp>(), std::declval<_Up>()))>>
797 template<
typename _Tp,
typename _Up>
798 static constexpr
bool __ptr_cmp = __and_<
799 __not_overloaded<_Tp, _Up>,
804 #endif // __glibcxx_transparent_operators
816 #ifdef __glibcxx_transparent_operators // C++ >= 14
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>
842 struct logical_or :
public binary_function<_Tp, _Tp, bool>
846 operator()(
const _Tp& __x,
const _Tp& __y)
const
847 {
return __x || __y; }
851 template<
typename _Tp>
852 struct logical_not :
public unary_function<_Tp, bool>
856 operator()(
const _Tp& __x)
const
859 #pragma GCC diagnostic pop
861 #ifdef __glibcxx_transparent_operators // C++ >= 14
866 template <
typename _Tp,
typename _Up>
869 operator()(_Tp&& __t, _Up&& __u)
const
870 noexcept(noexcept(std::forward<_Tp>(__t) && std::forward<_Up>(__u)))
871 -> decltype(std::forward<_Tp>(__t) && std::forward<_Up>(__u))
872 {
return std::forward<_Tp>(__t) && std::forward<_Up>(__u); }
874 typedef __is_transparent is_transparent;
881 template <
typename _Tp,
typename _Up>
884 operator()(_Tp&& __t, _Up&& __u)
const
885 noexcept(noexcept(std::forward<_Tp>(__t) || std::forward<_Up>(__u)))
886 -> decltype(std::forward<_Tp>(__t) || std::forward<_Up>(__u))
887 {
return std::forward<_Tp>(__t) || std::forward<_Up>(__u); }
889 typedef __is_transparent is_transparent;
896 template <
typename _Tp>
899 operator()(_Tp&& __t)
const
900 noexcept(noexcept(!std::forward<_Tp>(__t)))
901 -> decltype(!std::forward<_Tp>(__t))
902 {
return !std::forward<_Tp>(__t); }
904 typedef __is_transparent is_transparent;
906 #endif // __glibcxx_transparent_operators
909 #ifdef __glibcxx_transparent_operators // C++ >= 14
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 // C++ >= 14
969 template <
typename _Tp,
typename _Up>
972 operator()(_Tp&& __t, _Up&& __u)
const
973 noexcept(noexcept(std::forward<_Tp>(__t) & std::forward<_Up>(__u)))
974 -> decltype(std::forward<_Tp>(__t) & std::forward<_Up>(__u))
975 {
return std::forward<_Tp>(__t) & std::forward<_Up>(__u); }
977 typedef __is_transparent is_transparent;
983 template <
typename _Tp,
typename _Up>
986 operator()(_Tp&& __t, _Up&& __u)
const
987 noexcept(noexcept(std::forward<_Tp>(__t) | std::forward<_Up>(__u)))
988 -> decltype(std::forward<_Tp>(__t) | std::forward<_Up>(__u))
989 {
return std::forward<_Tp>(__t) | std::forward<_Up>(__u); }
991 typedef __is_transparent is_transparent;
997 template <
typename _Tp,
typename _Up>
1000 operator()(_Tp&& __t, _Up&& __u)
const
1001 noexcept(noexcept(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u)))
1002 -> decltype(std::forward<_Tp>(__t) ^ std::forward<_Up>(__u))
1003 {
return std::forward<_Tp>(__t) ^ std::forward<_Up>(__u); }
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>
1067 _GLIBCXX14_CONSTEXPR
1071 _GLIBCXX14_CONSTEXPR
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")
1080 _GLIBCXX14_CONSTEXPR
1086 template<
typename _Predicate>
1089 typename _Predicate::second_argument_type, bool>
1095 _GLIBCXX14_CONSTEXPR
1099 _GLIBCXX14_CONSTEXPR
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")
1109 _GLIBCXX14_CONSTEXPR
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>
1171 _Result (*_M_ptr)(_Arg1, _Arg2);
1181 operator()(_Arg1 __x, _Arg2 __y)
const
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 // C++ >= 14
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