29 #ifndef _GLIBCXX_TYPE_TRAITS
30 #define _GLIBCXX_TYPE_TRAITS 1
32 #pragma GCC system_header
34 #if __cplusplus < 201103L
40 namespace std _GLIBCXX_VISIBILITY(default)
42 _GLIBCXX_BEGIN_NAMESPACE_VERSION
56 template<
typename _Tp, _Tp __v>
59 static constexpr _Tp value = __v;
60 typedef _Tp value_type;
62 constexpr
operator value_type()
const {
return value; }
63 #if __cplusplus > 201103L
64 constexpr value_type operator()()
const {
return value; }
68 template<
typename _Tp, _Tp __v>
79 template<
bool,
typename,
typename>
90 template<
typename _B1>
95 template<
typename _B1,
typename _B2>
96 struct __or_<_B1, _B2>
97 :
public conditional<_B1::value, _B1, _B2>::type
100 template<
typename _B1,
typename _B2,
typename _B3,
typename... _Bn>
101 struct __or_<_B1, _B2, _B3, _Bn...>
102 :
public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type
105 template<
typename...>
113 template<
typename _B1>
118 template<
typename _B1,
typename _B2>
119 struct __and_<_B1, _B2>
120 :
public conditional<_B1::value, _B2, _B1>::type
123 template<
typename _B1,
typename _B2,
typename _B3,
typename... _Bn>
124 struct __and_<_B1, _B2, _B3, _Bn...>
125 :
public conditional<_B1::value, __and_<_B2, _B3, _Bn...>, _B1>::type
128 template<
typename _Pp>
130 :
public integral_constant<bool, !_Pp::value>
138 template<
typename _Tp>
139 struct __success_type
140 {
typedef _Tp type; };
142 struct __failure_type
151 struct __is_void_helper
155 struct __is_void_helper<void>
159 template<
typename _Tp>
161 :
public __is_void_helper<typename remove_cv<_Tp>::type>
::type
165 struct __is_integral_helper
169 struct __is_integral_helper<bool>
173 struct __is_integral_helper<char>
177 struct __is_integral_helper<signed char>
181 struct __is_integral_helper<unsigned char>
184 #ifdef _GLIBCXX_USE_WCHAR_T
186 struct __is_integral_helper<wchar_t>
191 struct __is_integral_helper<char16_t>
195 struct __is_integral_helper<char32_t>
199 struct __is_integral_helper<short>
203 struct __is_integral_helper<unsigned short>
207 struct __is_integral_helper<int>
211 struct __is_integral_helper<unsigned int>
215 struct __is_integral_helper<long>
219 struct __is_integral_helper<unsigned long>
223 struct __is_integral_helper<long long>
227 struct __is_integral_helper<unsigned long long>
230 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
232 struct __is_integral_helper<__int128>
236 struct __is_integral_helper<unsigned __int128>
241 template<
typename _Tp>
243 :
public __is_integral_helper<typename remove_cv<_Tp>::type>
::type
247 struct __is_floating_point_helper
251 struct __is_floating_point_helper<float>
255 struct __is_floating_point_helper<double>
259 struct __is_floating_point_helper<long double>
262 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
264 struct __is_floating_point_helper<__float128>
269 template<
typename _Tp>
271 :
public __is_floating_point_helper<typename remove_cv<_Tp>::type>::type
279 template<
typename _Tp, std::
size_t _Size>
283 template<
typename _Tp>
284 struct is_array<_Tp[]>
288 struct __is_pointer_helper
291 template<
typename _Tp>
292 struct __is_pointer_helper<_Tp*>
296 template<
typename _Tp>
298 :
public __is_pointer_helper<typename remove_cv<_Tp>::type>::type
306 template<
typename _Tp>
315 template<
typename _Tp>
323 struct __is_member_object_pointer_helper
326 template<
typename _Tp,
typename _Cp>
327 struct __is_member_object_pointer_helper<_Tp _Cp::*>
331 template<
typename _Tp>
333 :
public __is_member_object_pointer_helper<
334 typename remove_cv<_Tp>::type>::type
338 struct __is_member_function_pointer_helper
341 template<
typename _Tp,
typename _Cp>
342 struct __is_member_function_pointer_helper<_Tp _Cp::*>
343 :
public integral_constant<bool, is_function<_Tp>::value> { };
346 template<
typename _Tp>
348 :
public __is_member_function_pointer_helper<
349 typename remove_cv<_Tp>::type>
::type
353 template<
typename _Tp>
359 template<
typename _Tp>
365 template<
typename _Tp>
375 template<
typename _Res,
typename... _ArgTypes>
376 struct is_function<_Res(_ArgTypes...)>
379 template<
typename _Res,
typename... _ArgTypes>
380 struct is_function<_Res(_ArgTypes...) &>
383 template<
typename _Res,
typename... _ArgTypes>
384 struct is_function<_Res(_ArgTypes...) &&>
387 template<
typename _Res,
typename... _ArgTypes>
388 struct is_function<_Res(_ArgTypes......)>
391 template<
typename _Res,
typename... _ArgTypes>
392 struct is_function<_Res(_ArgTypes......) &>
395 template<
typename _Res,
typename... _ArgTypes>
396 struct is_function<_Res(_ArgTypes......) &&>
399 template<
typename _Res,
typename... _ArgTypes>
400 struct is_function<_Res(_ArgTypes...) const>
403 template<
typename _Res,
typename... _ArgTypes>
404 struct is_function<_Res(_ArgTypes...) const &>
407 template<
typename _Res,
typename... _ArgTypes>
408 struct is_function<_Res(_ArgTypes...) const &&>
411 template<
typename _Res,
typename... _ArgTypes>
412 struct is_function<_Res(_ArgTypes......) const>
415 template<
typename _Res,
typename... _ArgTypes>
416 struct is_function<_Res(_ArgTypes......) const &>
419 template<
typename _Res,
typename... _ArgTypes>
420 struct is_function<_Res(_ArgTypes......) const &&>
423 template<
typename _Res,
typename... _ArgTypes>
424 struct is_function<_Res(_ArgTypes...) volatile>
427 template<
typename _Res,
typename... _ArgTypes>
428 struct is_function<_Res(_ArgTypes...) volatile &>
431 template<
typename _Res,
typename... _ArgTypes>
432 struct is_function<_Res(_ArgTypes...) volatile &&>
435 template<
typename _Res,
typename... _ArgTypes>
436 struct is_function<_Res(_ArgTypes......) volatile>
439 template<
typename _Res,
typename... _ArgTypes>
440 struct is_function<_Res(_ArgTypes......) volatile &>
443 template<
typename _Res,
typename... _ArgTypes>
444 struct is_function<_Res(_ArgTypes......) volatile &&>
447 template<
typename _Res,
typename... _ArgTypes>
448 struct is_function<_Res(_ArgTypes...) const volatile>
451 template<
typename _Res,
typename... _ArgTypes>
452 struct is_function<_Res(_ArgTypes...) const volatile &>
455 template<
typename _Res,
typename... _ArgTypes>
456 struct is_function<_Res(_ArgTypes...) const volatile &&>
459 template<
typename _Res,
typename... _ArgTypes>
460 struct is_function<_Res(_ArgTypes......) const volatile>
463 template<
typename _Res,
typename... _ArgTypes>
464 struct is_function<_Res(_ArgTypes......) const volatile &>
467 template<
typename _Res,
typename... _ArgTypes>
468 struct is_function<_Res(_ArgTypes......) const volatile &&>
472 struct __is_null_pointer_helper
476 struct __is_null_pointer_helper<std::nullptr_t>
480 template<
typename _Tp>
482 :
public __is_null_pointer_helper<typename remove_cv<_Tp>::type>::type
486 template<
typename _Tp>
494 template<
typename _Tp>
496 :
public __or_<is_lvalue_reference<_Tp>,
497 is_rvalue_reference<_Tp>>::type
501 template<
typename _Tp>
503 :
public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
507 template<
typename _Tp>
509 :
public __or_<is_arithmetic<_Tp>, is_void<_Tp>,
510 is_null_pointer<_Tp>>::type
514 template<
typename _Tp>
516 :
public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
524 template<
typename _Tp>
526 :
public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
527 is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type
531 template<
typename _Tp>
535 template<
typename _Tp>
536 struct __is_member_pointer_helper
539 template<
typename _Tp,
typename _Cp>
540 struct __is_member_pointer_helper<_Tp _Cp::*>
544 template<
typename _Tp>
545 struct is_member_pointer
546 :
public __is_member_pointer_helper<typename remove_cv<_Tp>::type>::type
551 template<
typename _Tp>
552 struct __is_referenceable
553 :
public __or_<is_object<_Tp>, is_reference<_Tp>>::type
556 template<
typename _Res,
typename... _Args>
557 struct __is_referenceable<_Res(_Args...)>
561 template<
typename _Res,
typename... _Args>
562 struct __is_referenceable<_Res(_Args......)>
573 template<
typename _Tp>
582 template<
typename _Tp>
587 template<
typename _Tp>
595 template<
typename _Tp>
602 template<
typename _Tp>
608 template<
typename _Tp>
614 template<
typename _Tp>
620 template<
typename _Tp>
626 template<
typename _Tp>
631 template<
typename _Tp,
633 struct __is_signed_helper
636 template<
typename _Tp>
637 struct __is_signed_helper<_Tp, true>
638 :
public integral_constant<bool, _Tp(-1) < _Tp(0)>
642 template<typename _Tp>
644 : public __is_signed_helper<_Tp>::type
648 template<typename _Tp>
650 : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type
657 struct add_rvalue_reference;
663 template<typename _Tp>
664 typename add_rvalue_reference<_Tp>::type declval() noexcept;
666 template<typename, unsigned = 0>
670 struct remove_all_extents;
672 template<typename _Tp>
673 struct __is_array_known_bounds
674 : public integral_constant<bool, (extent<_Tp>::value > 0)>
677 template<
typename _Tp>
678 struct __is_array_unknown_bounds
679 :
public __and_<is_array<_Tp>, __not_<extent<_Tp>>>::type
687 struct __do_is_destructible_impl
689 template<
typename _Tp,
typename = decltype(declval<_Tp&>().~_Tp())>
696 template<
typename _Tp>
697 struct __is_destructible_impl
698 :
public __do_is_destructible_impl
700 typedef decltype(__test<_Tp>(0)) type;
703 template<typename _Tp,
704 bool = __or_<is_void<_Tp>,
705 __is_array_unknown_bounds<_Tp>,
706 is_function<_Tp>>::value,
707 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
708 struct __is_destructible_safe;
710 template<typename _Tp>
711 struct __is_destructible_safe<_Tp, false, false>
712 : public __is_destructible_impl<typename
713 remove_all_extents<_Tp>::type>::type
716 template<
typename _Tp>
717 struct __is_destructible_safe<_Tp, true, false>
720 template<
typename _Tp>
721 struct __is_destructible_safe<_Tp, false, true>
725 template<
typename _Tp>
726 struct is_destructible
727 :
public __is_destructible_safe<_Tp>::type
734 struct __do_is_nt_destructible_impl
736 template<
typename _Tp>
737 static integral_constant<bool, noexcept(declval<_Tp&>().~_Tp())>
744 template<
typename _Tp>
745 struct __is_nt_destructible_impl
746 :
public __do_is_nt_destructible_impl
748 typedef decltype(__test<_Tp>(0)) type;
751 template<typename _Tp,
752 bool = __or_<is_void<_Tp>,
753 __is_array_unknown_bounds<_Tp>,
754 is_function<_Tp>>::value,
755 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
756 struct __is_nt_destructible_safe;
758 template<typename _Tp>
759 struct __is_nt_destructible_safe<_Tp, false, false>
760 : public __is_nt_destructible_impl<typename
761 remove_all_extents<_Tp>::type>::type
764 template<
typename _Tp>
765 struct __is_nt_destructible_safe<_Tp, true, false>
768 template<
typename _Tp>
769 struct __is_nt_destructible_safe<_Tp, false, true>
773 template<
typename _Tp>
774 struct is_nothrow_destructible
775 :
public __is_nt_destructible_safe<_Tp>::type
778 struct __do_is_default_constructible_impl
780 template<
typename _Tp,
typename = decltype(_Tp())>
787 template<
typename _Tp>
788 struct __is_default_constructible_impl
789 :
public __do_is_default_constructible_impl
791 typedef decltype(__test<_Tp>(0)) type;
794 template<typename _Tp>
795 struct __is_default_constructible_atom
796 : public __and_<__not_<is_void<_Tp>>,
797 __is_default_constructible_impl<_Tp>>::type
800 template<typename _Tp, bool = is_array<_Tp>::value>
801 struct __is_default_constructible_safe;
808 template<
typename _Tp>
809 struct __is_default_constructible_safe<_Tp, true>
810 :
public __and_<__is_array_known_bounds<_Tp>,
811 __is_default_constructible_atom<typename
812 remove_all_extents<_Tp>::type>>::type
815 template<
typename _Tp>
816 struct __is_default_constructible_safe<_Tp, false>
817 :
public __is_default_constructible_atom<_Tp>::type
821 template<
typename _Tp>
822 struct is_default_constructible
823 :
public __is_default_constructible_safe<_Tp>::type
838 struct __do_is_static_castable_impl
840 template<
typename _From,
typename _To,
typename
841 = decltype(static_cast<_To>(declval<_From>()))>
844 template<
typename,
typename>
848 template<
typename _From,
typename _To>
849 struct __is_static_castable_impl
850 :
public __do_is_static_castable_impl
852 typedef decltype(__test<_From, _To>(0)) type;
855 template<typename _From, typename _To>
856 struct __is_static_castable_safe
857 : public __is_static_castable_impl<_From, _To>::type
861 template<
typename _From,
typename _To>
862 struct __is_static_castable
863 :
public integral_constant<bool, (__is_static_castable_safe<
872 struct __do_is_direct_constructible_impl
874 template<
typename _Tp,
typename _Arg,
typename
875 = decltype(::
new _Tp(declval<_Arg>()))>
878 template<
typename,
typename>
882 template<
typename _Tp,
typename _Arg>
883 struct __is_direct_constructible_impl
884 :
public __do_is_direct_constructible_impl
886 typedef decltype(__test<_Tp, _Arg>(0)) type;
889 template<typename _Tp, typename _Arg>
890 struct __is_direct_constructible_new_safe
891 : public __and_<is_destructible<_Tp>,
892 __is_direct_constructible_impl<_Tp, _Arg>>::type
895 template<
typename,
typename>
898 template<
typename,
typename>
902 struct remove_reference;
904 template<
typename _From,
typename _To,
bool
905 = __not_<__or_<is_void<_From>,
906 is_function<_From>>>::value>
907 struct __is_base_to_derived_ref;
911 template<
typename _From,
typename _To>
912 struct __is_base_to_derived_ref<_From, _To, true>
914 typedef typename remove_cv<
typename remove_reference<_From
915 >::type>::type __src_t;
916 typedef typename remove_cv<
typename remove_reference<_To
917 >::type>::type __dst_t;
918 typedef __and_<__not_<is_same<__src_t, __dst_t>>,
919 is_base_of<__src_t, __dst_t>> type;
920 static constexpr
bool value = type::value;
923 template<
typename _From,
typename _To>
924 struct __is_base_to_derived_ref<_From, _To, false>
928 template<
typename _From,
typename _To,
bool
929 = __and_<is_lvalue_reference<_From>,
930 is_rvalue_reference<_To>>::value>
931 struct __is_lvalue_to_rvalue_ref;
935 template<
typename _From,
typename _To>
936 struct __is_lvalue_to_rvalue_ref<_From, _To, true>
938 typedef typename remove_cv<
typename remove_reference<
939 _From>::type>::type __src_t;
940 typedef typename remove_cv<
typename remove_reference<
941 _To>::type>::type __dst_t;
942 typedef __and_<__not_<is_function<__src_t>>,
943 __or_<is_same<__src_t, __dst_t>,
944 is_base_of<__dst_t, __src_t>>> type;
945 static constexpr
bool value = type::value;
948 template<
typename _From,
typename _To>
949 struct __is_lvalue_to_rvalue_ref<_From, _To, false>
959 template<
typename _Tp,
typename _Arg>
960 struct __is_direct_constructible_ref_cast
961 :
public __and_<__is_static_castable<_Arg, _Tp>,
962 __not_<__or_<__is_base_to_derived_ref<_Arg, _Tp>,
963 __is_lvalue_to_rvalue_ref<_Arg, _Tp>
967 template<
typename _Tp,
typename _Arg>
968 struct __is_direct_constructible_new
969 :
public conditional<is_reference<_Tp>::value,
970 __is_direct_constructible_ref_cast<_Tp, _Arg>,
971 __is_direct_constructible_new_safe<_Tp, _Arg>
975 template<
typename _Tp,
typename _Arg>
976 struct __is_direct_constructible
977 :
public __is_direct_constructible_new<_Tp, _Arg>::type
985 struct __do_is_nary_constructible_impl
987 template<
typename _Tp,
typename... _Args,
typename
988 = decltype(_Tp(declval<_Args>()...))>
991 template<
typename,
typename...>
995 template<
typename _Tp,
typename... _Args>
996 struct __is_nary_constructible_impl
997 :
public __do_is_nary_constructible_impl
999 typedef decltype(__test<_Tp, _Args...>(0)) type;
1002 template<typename _Tp, typename... _Args>
1003 struct __is_nary_constructible
1004 : public __is_nary_constructible_impl<_Tp, _Args...>::type
1006 static_assert(
sizeof...(_Args) > 1,
1007 "Only useful for > 1 arguments");
1010 template<
typename _Tp,
typename... _Args>
1011 struct __is_constructible_impl
1012 :
public __is_nary_constructible<_Tp, _Args...>
1015 template<
typename _Tp,
typename _Arg>
1016 struct __is_constructible_impl<_Tp, _Arg>
1017 :
public __is_direct_constructible<_Tp, _Arg>
1020 template<
typename _Tp>
1021 struct __is_constructible_impl<_Tp>
1022 :
public is_default_constructible<_Tp>
1026 template<
typename _Tp,
typename... _Args>
1027 struct is_constructible
1028 :
public __is_constructible_impl<_Tp, _Args...>::type
1031 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1032 struct __is_copy_constructible_impl;
1034 template<
typename _Tp>
1035 struct __is_copy_constructible_impl<_Tp, false>
1038 template<
typename _Tp>
1039 struct __is_copy_constructible_impl<_Tp, true>
1040 :
public is_constructible<_Tp, const _Tp&>
1044 template<
typename _Tp>
1045 struct is_copy_constructible
1046 :
public __is_copy_constructible_impl<_Tp>
1049 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1050 struct __is_move_constructible_impl;
1052 template<
typename _Tp>
1053 struct __is_move_constructible_impl<_Tp, false>
1056 template<
typename _Tp>
1057 struct __is_move_constructible_impl<_Tp, true>
1058 :
public is_constructible<_Tp, _Tp&&>
1062 template<
typename _Tp>
1063 struct is_move_constructible
1064 :
public __is_move_constructible_impl<_Tp>
1067 template<
typename _Tp>
1068 struct __is_nt_default_constructible_atom
1069 :
public integral_constant<bool, noexcept(_Tp())>
1072 template<typename _Tp, bool = is_array<_Tp>::value>
1073 struct __is_nt_default_constructible_impl;
1075 template<
typename _Tp>
1076 struct __is_nt_default_constructible_impl<_Tp, true>
1077 :
public __and_<__is_array_known_bounds<_Tp>,
1078 __is_nt_default_constructible_atom<typename
1079 remove_all_extents<_Tp>::type>>::type
1082 template<
typename _Tp>
1083 struct __is_nt_default_constructible_impl<_Tp, false>
1084 :
public __is_nt_default_constructible_atom<_Tp>
1088 template<
typename _Tp>
1089 struct is_nothrow_default_constructible
1090 :
public __and_<is_default_constructible<_Tp>,
1091 __is_nt_default_constructible_impl<_Tp>>::type
1094 template<
typename _Tp,
typename... _Args>
1095 struct __is_nt_constructible_impl
1096 :
public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
1099 template<
typename _Tp,
typename _Arg>
1100 struct __is_nt_constructible_impl<_Tp, _Arg>
1101 :
public integral_constant<bool,
1102 noexcept(static_cast<_Tp>(declval<_Arg>()))>
1105 template<
typename _Tp>
1106 struct __is_nt_constructible_impl<_Tp>
1107 :
public is_nothrow_default_constructible<_Tp>
1111 template<
typename _Tp,
typename... _Args>
1112 struct is_nothrow_constructible
1113 :
public __and_<is_constructible<_Tp, _Args...>,
1114 __is_nt_constructible_impl<_Tp, _Args...>>::type
1117 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1118 struct __is_nothrow_copy_constructible_impl;
1120 template<
typename _Tp>
1121 struct __is_nothrow_copy_constructible_impl<_Tp, false>
1124 template<
typename _Tp>
1125 struct __is_nothrow_copy_constructible_impl<_Tp, true>
1126 :
public is_nothrow_constructible<_Tp, const _Tp&>
1130 template<
typename _Tp>
1131 struct is_nothrow_copy_constructible
1132 :
public __is_nothrow_copy_constructible_impl<_Tp>
1135 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1136 struct __is_nothrow_move_constructible_impl;
1138 template<
typename _Tp>
1139 struct __is_nothrow_move_constructible_impl<_Tp, false>
1142 template<
typename _Tp>
1143 struct __is_nothrow_move_constructible_impl<_Tp, true>
1144 :
public is_nothrow_constructible<_Tp, _Tp&&>
1148 template<
typename _Tp>
1149 struct is_nothrow_move_constructible
1150 :
public __is_nothrow_move_constructible_impl<_Tp>
1153 template<
typename _Tp,
typename _Up>
1154 class __is_assignable_helper
1156 template<
typename _Tp1,
typename _Up1,
1157 typename = decltype(declval<_Tp1>() = declval<_Up1>())>
1161 template<
typename,
typename>
1166 typedef decltype(__test<_Tp, _Up>(0)) type;
1170 template<typename _Tp, typename _Up>
1171 struct is_assignable
1172 : public __is_assignable_helper<_Tp, _Up>::type
1175 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1176 struct __is_copy_assignable_impl;
1178 template<
typename _Tp>
1179 struct __is_copy_assignable_impl<_Tp, false>
1182 template<
typename _Tp>
1183 struct __is_copy_assignable_impl<_Tp, true>
1184 :
public is_assignable<_Tp&, const _Tp&>
1188 template<
typename _Tp>
1189 struct is_copy_assignable
1190 :
public __is_copy_assignable_impl<_Tp>
1193 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1194 struct __is_move_assignable_impl;
1196 template<
typename _Tp>
1197 struct __is_move_assignable_impl<_Tp, false>
1200 template<
typename _Tp>
1201 struct __is_move_assignable_impl<_Tp, true>
1202 :
public is_assignable<_Tp&, _Tp&&>
1206 template<
typename _Tp>
1207 struct is_move_assignable
1208 :
public __is_move_assignable_impl<_Tp>
1211 template<
typename _Tp,
typename _Up>
1212 struct __is_nt_assignable_impl
1213 :
public integral_constant<bool, noexcept(declval<_Tp>() = declval<_Up>())>
1217 template<
typename _Tp,
typename _Up>
1218 struct is_nothrow_assignable
1219 :
public __and_<is_assignable<_Tp, _Up>,
1220 __is_nt_assignable_impl<_Tp, _Up>>::type
1223 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1224 struct __is_nt_copy_assignable_impl;
1226 template<
typename _Tp>
1227 struct __is_nt_copy_assignable_impl<_Tp, false>
1230 template<
typename _Tp>
1231 struct __is_nt_copy_assignable_impl<_Tp, true>
1232 :
public is_nothrow_assignable<_Tp&, const _Tp&>
1236 template<
typename _Tp>
1237 struct is_nothrow_copy_assignable
1238 :
public __is_nt_copy_assignable_impl<_Tp>
1241 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1242 struct __is_nt_move_assignable_impl;
1244 template<
typename _Tp>
1245 struct __is_nt_move_assignable_impl<_Tp, false>
1248 template<
typename _Tp>
1249 struct __is_nt_move_assignable_impl<_Tp, true>
1250 :
public is_nothrow_assignable<_Tp&, _Tp&&>
1254 template<
typename _Tp>
1255 struct is_nothrow_move_assignable
1256 :
public __is_nt_move_assignable_impl<_Tp>
1274 template<
typename _Tp>
1275 struct is_trivially_destructible
1276 :
public __and_<is_destructible<_Tp>, integral_constant<bool,
1277 __has_trivial_destructor(_Tp)>>::type
1281 template<
typename _Tp>
1282 struct has_trivial_default_constructor
1283 :
public integral_constant<bool, __has_trivial_constructor(_Tp)>
1287 template<
typename _Tp>
1288 struct has_trivial_copy_constructor
1289 :
public integral_constant<bool, __has_trivial_copy(_Tp)>
1293 template<
typename _Tp>
1294 struct has_trivial_copy_assign
1295 :
public integral_constant<bool, __has_trivial_assign(_Tp)>
1299 template<
typename _Tp>
1300 struct has_virtual_destructor
1301 :
public integral_constant<bool, __has_virtual_destructor(_Tp)>
1308 template<
typename _Tp>
1310 :
public integral_constant<std::size_t, __alignof__(_Tp)> { };
1315 :
public integral_constant<std::size_t, 0> { };
1317 template<
typename _Tp, std::
size_t _Size>
1318 struct rank<_Tp[_Size]>
1319 :
public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1321 template<
typename _Tp>
1323 :
public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1326 template<
typename,
unsigned _U
int>
1328 :
public integral_constant<std::size_t, 0> { };
1330 template<
typename _Tp,
unsigned _U
int, std::
size_t _Size>
1331 struct extent<_Tp[_Size], _Uint>
1332 :
public integral_constant<std::size_t,
1333 _Uint == 0 ? _Size : extent<_Tp,
1337 template<
typename _Tp,
unsigned _U
int>
1338 struct extent<_Tp[], _Uint>
1339 :
public integral_constant<std::size_t,
1340 _Uint == 0 ? 0 : extent<_Tp,
1348 template<
typename,
typename>
1352 template<
typename _Tp>
1353 struct is_same<_Tp, _Tp>
1357 template<
typename _Base,
typename _Derived>
1359 :
public integral_constant<bool, __is_base_of(_Base, _Derived)>
1362 template<
typename _From,
typename _To,
1363 bool = __or_<is_void<_From>, is_function<_To>,
1364 is_array<_To>>::value>
1365 struct __is_convertible_helper
1366 {
typedef typename is_void<_To>::type type; };
1368 template<
typename _From,
typename _To>
1369 class __is_convertible_helper<_From, _To, false>
1371 template<
typename _To1>
1372 static void __test_aux(_To1);
1374 template<
typename _From1,
typename _To1,
1375 typename = decltype(__test_aux<_To1>(std::declval<_From1>()))>
1379 template<
typename,
typename>
1384 typedef decltype(__test<_From, _To>(0)) type;
1389 template<typename _From, typename _To>
1390 struct is_convertible
1391 : public __is_convertible_helper<_From, _To>::type
1398 template<
typename _Tp>
1400 {
typedef _Tp type; };
1402 template<
typename _Tp>
1403 struct remove_const<_Tp const>
1404 {
typedef _Tp type; };
1407 template<
typename _Tp>
1408 struct remove_volatile
1409 {
typedef _Tp type; };
1411 template<
typename _Tp>
1412 struct remove_volatile<_Tp volatile>
1413 {
typedef _Tp type; };
1416 template<
typename _Tp>
1420 remove_const<typename remove_volatile<_Tp>::type>::type type;
1424 template<
typename _Tp>
1426 {
typedef _Tp
const type; };
1429 template<
typename _Tp>
1431 {
typedef _Tp
volatile type; };
1434 template<
typename _Tp>
1438 add_const<typename add_volatile<_Tp>::type>::type type;
1445 template<
typename _Tp>
1446 struct remove_reference
1447 {
typedef _Tp type; };
1449 template<
typename _Tp>
1450 struct remove_reference<_Tp&>
1451 {
typedef _Tp type; };
1453 template<
typename _Tp>
1454 struct remove_reference<_Tp&&>
1455 {
typedef _Tp type; };
1457 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1458 struct __add_lvalue_reference_helper
1459 {
typedef _Tp type; };
1461 template<
typename _Tp>
1462 struct __add_lvalue_reference_helper<_Tp, true>
1463 {
typedef _Tp& type; };
1466 template<
typename _Tp>
1467 struct add_lvalue_reference
1468 :
public __add_lvalue_reference_helper<_Tp>
1471 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1472 struct __add_rvalue_reference_helper
1473 {
typedef _Tp type; };
1475 template<
typename _Tp>
1476 struct __add_rvalue_reference_helper<_Tp, true>
1477 {
typedef _Tp&& type; };
1480 template<
typename _Tp>
1481 struct add_rvalue_reference
1482 :
public __add_rvalue_reference_helper<_Tp>
1489 template<
typename _Unqualified,
bool _IsConst,
bool _IsVol>
1490 struct __cv_selector;
1492 template<
typename _Unqualified>
1493 struct __cv_selector<_Unqualified, false, false>
1494 {
typedef _Unqualified __type; };
1496 template<
typename _Unqualified>
1497 struct __cv_selector<_Unqualified, false, true>
1498 {
typedef volatile _Unqualified __type; };
1500 template<
typename _Unqualified>
1501 struct __cv_selector<_Unqualified, true, false>
1502 {
typedef const _Unqualified __type; };
1504 template<
typename _Unqualified>
1505 struct __cv_selector<_Unqualified, true, true>
1506 {
typedef const volatile _Unqualified __type; };
1508 template<
typename _Qualified,
typename _Unqualified,
1509 bool _IsConst = is_const<_Qualified>::value,
1510 bool _IsVol = is_volatile<_Qualified>::value>
1511 class __match_cv_qualifiers
1513 typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match;
1516 typedef typename __match::__type __type;
1520 template<
typename _Tp>
1521 struct __make_unsigned
1522 {
typedef _Tp __type; };
1525 struct __make_unsigned<char>
1526 {
typedef unsigned char __type; };
1529 struct __make_unsigned<signed char>
1530 {
typedef unsigned char __type; };
1533 struct __make_unsigned<short>
1534 {
typedef unsigned short __type; };
1537 struct __make_unsigned<int>
1538 {
typedef unsigned int __type; };
1541 struct __make_unsigned<long>
1542 {
typedef unsigned long __type; };
1545 struct __make_unsigned<long long>
1546 {
typedef unsigned long long __type; };
1548 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
1550 struct __make_unsigned<__int128>
1551 {
typedef unsigned __int128 __type; };
1555 template<
typename _Tp,
1556 bool _IsInt = is_integral<_Tp>::value,
1557 bool _IsEnum = is_enum<_Tp>::value>
1558 class __make_unsigned_selector;
1560 template<
typename _Tp>
1561 class __make_unsigned_selector<_Tp, true, false>
1563 typedef __make_unsigned<typename remove_cv<_Tp>::type> __unsignedt;
1564 typedef typename __unsignedt::__type __unsigned_type;
1565 typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned;
1568 typedef typename __cv_unsigned::__type __type;
1571 template<
typename _Tp>
1572 class __make_unsigned_selector<_Tp, false, true>
1575 typedef unsigned char __smallest;
1576 static const bool __b0 =
sizeof(_Tp) <=
sizeof(__smallest);
1577 static const bool __b1 =
sizeof(_Tp) <=
sizeof(
unsigned short);
1578 static const bool __b2 =
sizeof(_Tp) <=
sizeof(
unsigned int);
1579 typedef conditional<__b2, unsigned int, unsigned long> __cond2;
1580 typedef typename __cond2::type __cond2_type;
1581 typedef conditional<__b1, unsigned short, __cond2_type> __cond1;
1582 typedef typename __cond1::type __cond1_type;
1585 typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
1592 template<
typename _Tp>
1593 struct make_unsigned
1594 {
typedef typename __make_unsigned_selector<_Tp>::__type type; };
1598 struct make_unsigned<bool>;
1602 template<
typename _Tp>
1603 struct __make_signed
1604 {
typedef _Tp __type; };
1607 struct __make_signed<char>
1608 {
typedef signed char __type; };
1611 struct __make_signed<unsigned char>
1612 {
typedef signed char __type; };
1615 struct __make_signed<unsigned short>
1616 {
typedef signed short __type; };
1619 struct __make_signed<unsigned int>
1620 {
typedef signed int __type; };
1623 struct __make_signed<unsigned long>
1624 {
typedef signed long __type; };
1627 struct __make_signed<unsigned long long>
1628 {
typedef signed long long __type; };
1630 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
1632 struct __make_signed<unsigned __int128>
1633 {
typedef __int128 __type; };
1637 template<
typename _Tp,
1638 bool _IsInt = is_integral<_Tp>::value,
1639 bool _IsEnum = is_enum<_Tp>::value>
1640 class __make_signed_selector;
1642 template<
typename _Tp>
1643 class __make_signed_selector<_Tp, true, false>
1645 typedef __make_signed<typename remove_cv<_Tp>::type> __signedt;
1646 typedef typename __signedt::__type __signed_type;
1647 typedef __match_cv_qualifiers<_Tp, __signed_type> __cv_signed;
1650 typedef typename __cv_signed::__type __type;
1653 template<
typename _Tp>
1654 class __make_signed_selector<_Tp, false, true>
1657 typedef signed char __smallest;
1658 static const bool __b0 =
sizeof(_Tp) <=
sizeof(__smallest);
1659 static const bool __b1 =
sizeof(_Tp) <=
sizeof(
signed short);
1660 static const bool __b2 =
sizeof(_Tp) <=
sizeof(
signed int);
1661 typedef conditional<__b2, signed int, signed long> __cond2;
1662 typedef typename __cond2::type __cond2_type;
1663 typedef conditional<__b1, signed short, __cond2_type> __cond1;
1664 typedef typename __cond1::type __cond1_type;
1667 typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
1674 template<
typename _Tp>
1676 {
typedef typename __make_signed_selector<_Tp>::__type type; };
1680 struct make_signed<bool>;
1686 template<
typename _Tp>
1687 struct remove_extent
1688 {
typedef _Tp type; };
1690 template<
typename _Tp, std::
size_t _Size>
1691 struct remove_extent<_Tp[_Size]>
1692 {
typedef _Tp type; };
1694 template<
typename _Tp>
1695 struct remove_extent<_Tp[]>
1696 {
typedef _Tp type; };
1699 template<
typename _Tp>
1700 struct remove_all_extents
1701 {
typedef _Tp type; };
1703 template<
typename _Tp, std::
size_t _Size>
1704 struct remove_all_extents<_Tp[_Size]>
1705 {
typedef typename remove_all_extents<_Tp>::type type; };
1707 template<
typename _Tp>
1708 struct remove_all_extents<_Tp[]>
1709 {
typedef typename remove_all_extents<_Tp>::type type; };
1714 template<
typename _Tp,
typename>
1715 struct __remove_pointer_helper
1716 {
typedef _Tp type; };
1718 template<
typename _Tp,
typename _Up>
1719 struct __remove_pointer_helper<_Tp, _Up*>
1720 {
typedef _Up type; };
1723 template<
typename _Tp>
1724 struct remove_pointer
1725 :
public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type>
1729 template<
typename _Tp,
bool = __or_<__is_referenceable<_Tp>,
1730 is_
void<_Tp>>::value>
1731 struct __add_pointer_helper
1732 {
typedef _Tp type; };
1734 template<
typename _Tp>
1735 struct __add_pointer_helper<_Tp, true>
1736 {
typedef typename remove_reference<_Tp>::type* type; };
1738 template<
typename _Tp>
1740 :
public __add_pointer_helper<_Tp>
1744 template<std::
size_t _Len>
1745 struct __aligned_storage_msa
1749 unsigned char __data[_Len];
1750 struct __attribute__((__aligned__)) { } __align;
1764 template<std::size_t _Len, std::size_t _Align =
1765 __alignof__(
typename __aligned_storage_msa<_Len>::__type)>
1766 struct aligned_storage
1770 unsigned char __data[_Len];
1771 struct __attribute__((__aligned__((_Align)))) { } __align;
1778 template<
typename _Up,
1779 bool _IsArray = is_array<_Up>::value,
1780 bool _IsFunction = is_function<_Up>::value>
1781 struct __decay_selector;
1784 template<
typename _Up>
1785 struct __decay_selector<_Up, false, false>
1786 {
typedef typename remove_cv<_Up>::type __type; };
1788 template<
typename _Up>
1789 struct __decay_selector<_Up, true, false>
1790 {
typedef typename remove_extent<_Up>::type* __type; };
1792 template<
typename _Up>
1793 struct __decay_selector<_Up, false, true>
1794 {
typedef typename add_pointer<_Up>::type __type; };
1797 template<
typename _Tp>
1800 typedef typename remove_reference<_Tp>::type __remove_type;
1803 typedef typename __decay_selector<__remove_type>::__type type;
1806 template<
typename _Tp>
1807 class reference_wrapper;
1810 template<
typename _Tp>
1811 struct __strip_reference_wrapper
1816 template<
typename _Tp>
1817 struct __strip_reference_wrapper<reference_wrapper<_Tp> >
1819 typedef _Tp& __type;
1822 template<
typename _Tp>
1823 struct __decay_and_strip
1825 typedef typename __strip_reference_wrapper<
1826 typename decay<_Tp>::type>::__type __type;
1832 template<
bool,
typename _Tp =
void>
1837 template<
typename _Tp>
1838 struct enable_if<true, _Tp>
1839 {
typedef _Tp type; };
1841 template<
typename... _Cond>
1842 using _Require =
typename enable_if<__and_<_Cond...>::value>::type;
1846 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
1848 {
typedef _Iftrue type; };
1851 template<
typename _Iftrue,
typename _Iffalse>
1852 struct conditional<false, _Iftrue, _Iffalse>
1853 {
typedef _Iffalse type; };
1856 template<
typename... _Tp>
1861 struct __do_common_type_impl
1863 template<
typename _Tp,
typename _Up>
1864 static __success_type<
typename decay<decltype
1865 (
true ? std::declval<_Tp>()
1866 : std::declval<_Up>())>::type> _S_test(
int);
1868 template<
typename,
typename>
1869 static __failure_type _S_test(...);
1872 template<
typename _Tp,
typename _Up>
1873 struct __common_type_impl
1874 :
private __do_common_type_impl
1876 typedef decltype(_S_test<_Tp, _Up>(0)) type;
1879 struct __do_member_type_wrapper
1881 template<
typename _Tp>
1882 static __success_type<typename _Tp::type> _S_test(
int);
1885 static __failure_type _S_test(...);
1888 template<
typename _Tp>
1889 struct __member_type_wrapper
1890 :
private __do_member_type_wrapper
1892 typedef decltype(_S_test<_Tp>(0)) type;
1895 template<typename _CTp, typename... _Args>
1896 struct __expanded_common_type_wrapper
1898 typedef common_type<
typename _CTp::type, _Args...> type;
1901 template<
typename... _Args>
1902 struct __expanded_common_type_wrapper<__failure_type, _Args...>
1903 {
typedef __failure_type type; };
1905 template<
typename _Tp>
1906 struct common_type<_Tp>
1907 {
typedef typename decay<_Tp>::type type; };
1909 template<
typename _Tp,
typename _Up>
1910 struct common_type<_Tp, _Up>
1911 :
public __common_type_impl<_Tp, _Up>::type
1914 template<
typename _Tp,
typename _Up,
typename... _Vp>
1915 struct common_type<_Tp, _Up, _Vp...>
1916 :
public __expanded_common_type_wrapper<typename __member_type_wrapper<
1917 common_type<_Tp, _Up>>::type, _Vp...>::type
1921 template<
typename _Tp>
1922 struct underlying_type
1924 typedef __underlying_type(_Tp) type;
1927 template<typename _Tp>
1928 struct __declval_protector
1930 static const bool __stop =
false;
1931 static typename add_rvalue_reference<_Tp>::type __delegate();
1934 template<
typename _Tp>
1935 inline typename add_rvalue_reference<_Tp>::type
1938 static_assert(__declval_protector<_Tp>::__stop,
1939 "declval() must not be used!");
1940 return __declval_protector<_Tp>::__delegate();
1944 template<
typename _Signature>
1950 struct __result_of_memfun_ref_impl
1952 template<
typename _Fp,
typename _Tp1,
typename... _Args>
1953 static __success_type<decltype(
1954 (std::declval<_Tp1>().*std::declval<_Fp>())(std::declval<_Args>()...)
1957 template<
typename...>
1958 static __failure_type _S_test(...);
1961 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
1962 struct __result_of_memfun_ref
1963 :
private __result_of_memfun_ref_impl
1965 typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type;
1969 struct __result_of_memfun_deref_impl
1971 template<
typename _Fp,
typename _Tp1,
typename... _Args>
1972 static __success_type<decltype(
1973 ((*std::declval<_Tp1>()).*std::declval<_Fp>())(std::declval<_Args>()...)
1976 template<
typename...>
1977 static __failure_type _S_test(...);
1980 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
1981 struct __result_of_memfun_deref
1982 :
private __result_of_memfun_deref_impl
1984 typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type;
1988 struct __result_of_memobj_ref_impl
1990 template<
typename _Fp,
typename _Tp1>
1991 static __success_type<decltype(
1992 std::declval<_Tp1>().*std::declval<_Fp>()
1995 template<
typename,
typename>
1996 static __failure_type _S_test(...);
1999 template<
typename _MemPtr,
typename _Arg>
2000 struct __result_of_memobj_ref
2001 :
private __result_of_memobj_ref_impl
2003 typedef decltype(_S_test<_MemPtr, _Arg>(0)) type;
2007 struct __result_of_memobj_deref_impl
2009 template<
typename _Fp,
typename _Tp1>
2010 static __success_type<decltype(
2011 (*std::declval<_Tp1>()).*std::declval<_Fp>()
2014 template<
typename,
typename>
2015 static __failure_type _S_test(...);
2018 template<
typename _MemPtr,
typename _Arg>
2019 struct __result_of_memobj_deref
2020 :
private __result_of_memobj_deref_impl
2022 typedef decltype(_S_test<_MemPtr, _Arg>(0)) type;
2025 template<typename _MemPtr, typename _Arg>
2026 struct __result_of_memobj;
2028 template<typename _Res, typename _Class, typename _Arg>
2029 struct __result_of_memobj<_Res _Class::*, _Arg>
2031 typedef typename remove_cv<
typename remove_reference<
2032 _Arg>::type>::type _Argval;
2033 typedef _Res _Class::* _MemPtr;
2034 typedef typename conditional<__or_<is_same<_Argval, _Class>,
2035 is_base_of<_Class, _Argval>>::value,
2036 __result_of_memobj_ref<_MemPtr, _Arg>,
2037 __result_of_memobj_deref<_MemPtr, _Arg>
2041 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2042 struct __result_of_memfun;
2044 template<
typename _Res,
typename _Class,
typename _Arg,
typename... _Args>
2045 struct __result_of_memfun<_Res _Class::*, _Arg, _Args...>
2047 typedef typename remove_cv<
typename remove_reference<
2048 _Arg>::type>::type _Argval;
2049 typedef _Res _Class::* _MemPtr;
2050 typedef typename conditional<__or_<is_same<_Argval, _Class>,
2051 is_base_of<_Class, _Argval>>::value,
2052 __result_of_memfun_ref<_MemPtr, _Arg, _Args...>,
2053 __result_of_memfun_deref<_MemPtr, _Arg, _Args...>
2057 template<bool, bool,
typename _Functor,
typename... _ArgTypes>
2058 struct __result_of_impl
2060 typedef __failure_type type;
2063 template<
typename _MemPtr,
typename _Arg>
2064 struct __result_of_impl<true, false, _MemPtr, _Arg>
2065 :
public __result_of_memobj<typename decay<_MemPtr>::type, _Arg>
2068 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2069 struct __result_of_impl<false, true, _MemPtr, _Arg, _Args...>
2070 :
public __result_of_memfun<typename decay<_MemPtr>::type, _Arg, _Args...>
2074 struct __result_of_other_impl
2076 template<
typename _Fn,
typename... _Args>
2077 static __success_type<decltype(
2078 std::declval<_Fn>()(std::declval<_Args>()...)
2081 template<
typename...>
2082 static __failure_type _S_test(...);
2085 template<
typename _Functor,
typename... _ArgTypes>
2086 struct __result_of_impl<false, false, _Functor, _ArgTypes...>
2087 :
private __result_of_other_impl
2089 typedef decltype(_S_test<_Functor, _ArgTypes...>(0)) type;
2092 template<typename _Functor, typename... _ArgTypes>
2093 struct result_of<_Functor(_ArgTypes...)>
2094 : public __result_of_impl<
2095 is_member_object_pointer<
2096 typename remove_reference<_Functor>::type
2098 is_member_function_pointer<
2099 typename remove_reference<_Functor>::type
2101 _Functor, _ArgTypes...
2111 #define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
2112 template<typename _Tp> \
2113 class __has_##_NTYPE##_helper \
2115 template<typename _Up> \
2119 template<typename _Up> \
2120 static true_type __test(_Wrap_type<typename _Up::_NTYPE>*); \
2122 template<typename _Up> \
2123 static false_type __test(...); \
2126 typedef decltype(__test<_Tp>(0)) type; \
2129 template<typename _Tp> \
2130 struct __has_##_NTYPE \
2131 : public __has_##_NTYPE##_helper \
2132 <typename remove_cv<_Tp>::type>::type \
2135 _GLIBCXX_END_NAMESPACE_VERSION
2140 #endif // _GLIBCXX_TYPE_TRAITS