29 #ifndef _GLIBCXX_TYPE_TRAITS
30 #define _GLIBCXX_TYPE_TRAITS 1
32 #pragma GCC system_header
34 #if __cplusplus < 201103L
40 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
41 # if defined (__UINT_LEAST16_TYPE__) && defined(__UINT_LEAST32_TYPE__)
44 typedef __UINT_LEAST16_TYPE__ uint_least16_t;
45 typedef __UINT_LEAST32_TYPE__ uint_least32_t;
52 namespace std _GLIBCXX_VISIBILITY(default)
54 _GLIBCXX_BEGIN_NAMESPACE_VERSION
68 template<
typename _Tp, _Tp __v>
71 static constexpr _Tp value = __v;
72 typedef _Tp value_type;
74 constexpr
operator value_type()
const {
return value; }
75 #if __cplusplus > 201103L
77 #define __cpp_lib_integral_constant_callable 201304
79 constexpr value_type operator()()
const {
return value; }
83 template<
typename _Tp, _Tp __v>
95 #if __cplusplus > 201402L
96 # define __cpp_lib_bool_constant 201505
103 template<
bool,
typename,
typename>
106 template<
typename...>
114 template<
typename _B1>
119 template<
typename _B1,
typename _B2>
120 struct __or_<_B1, _B2>
121 :
public conditional<_B1::value, _B1, _B2>::type
124 template<
typename _B1,
typename _B2,
typename _B3,
typename... _Bn>
125 struct __or_<_B1, _B2, _B3, _Bn...>
126 :
public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type
129 template<
typename...>
137 template<
typename _B1>
142 template<
typename _B1,
typename _B2>
143 struct __and_<_B1, _B2>
144 :
public conditional<_B1::value, _B2, _B1>::type
147 template<
typename _B1,
typename _B2,
typename _B3,
typename... _Bn>
148 struct __and_<_B1, _B2, _B3, _Bn...>
149 :
public conditional<_B1::value, __and_<_B2, _B3, _Bn...>, _B1>::type
152 template<
typename _Pp>
154 :
public integral_constant<bool, !_Pp::value>
158 __nonesuch() =
delete;
159 ~__nonesuch() =
delete;
160 __nonesuch(__nonesuch
const&) =
delete;
161 void operator=(__nonesuch
const&) =
delete;
164 #if __cplusplus > 201402L
166 #define __cpp_lib_logical_traits 201510
168 template<
typename... _Bn>
173 template<
typename... _Bn>
178 template<
typename _Pp>
189 template<
typename _Tp>
190 struct __success_type
191 {
typedef _Tp type; };
193 struct __failure_type
202 struct __is_void_helper
206 struct __is_void_helper<void>
210 template<
typename _Tp>
212 :
public __is_void_helper<typename remove_cv<_Tp>::type>
::type
216 struct __is_integral_helper
220 struct __is_integral_helper<bool>
224 struct __is_integral_helper<char>
228 struct __is_integral_helper<signed char>
232 struct __is_integral_helper<unsigned char>
235 #ifdef _GLIBCXX_USE_WCHAR_T
237 struct __is_integral_helper<wchar_t>
242 struct __is_integral_helper<char16_t>
246 struct __is_integral_helper<char32_t>
250 struct __is_integral_helper<short>
254 struct __is_integral_helper<unsigned short>
258 struct __is_integral_helper<int>
262 struct __is_integral_helper<unsigned int>
266 struct __is_integral_helper<long>
270 struct __is_integral_helper<unsigned long>
274 struct __is_integral_helper<long long>
278 struct __is_integral_helper<unsigned long long>
283 #if defined(__GLIBCXX_TYPE_INT_N_0)
285 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0>
289 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_0>
292 #if defined(__GLIBCXX_TYPE_INT_N_1)
294 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_1>
298 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_1>
301 #if defined(__GLIBCXX_TYPE_INT_N_2)
303 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_2>
307 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_2>
310 #if defined(__GLIBCXX_TYPE_INT_N_3)
312 struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_3>
316 struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_3>
321 template<
typename _Tp>
323 :
public __is_integral_helper<typename remove_cv<_Tp>::type>
::type
327 struct __is_floating_point_helper
331 struct __is_floating_point_helper<float>
335 struct __is_floating_point_helper<double>
339 struct __is_floating_point_helper<long double>
342 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
344 struct __is_floating_point_helper<__float128>
349 template<
typename _Tp>
351 :
public __is_floating_point_helper<typename remove_cv<_Tp>::type>::type
359 template<
typename _Tp, std::
size_t _Size>
363 template<
typename _Tp>
364 struct is_array<_Tp[]>
368 struct __is_pointer_helper
371 template<
typename _Tp>
372 struct __is_pointer_helper<_Tp*>
376 template<
typename _Tp>
378 :
public __is_pointer_helper<typename remove_cv<_Tp>::type>::type
386 template<
typename _Tp>
395 template<
typename _Tp>
403 struct __is_member_object_pointer_helper
406 template<
typename _Tp,
typename _Cp>
407 struct __is_member_object_pointer_helper<_Tp _Cp::*>
411 template<
typename _Tp>
413 :
public __is_member_object_pointer_helper<
414 typename remove_cv<_Tp>::type>::type
418 struct __is_member_function_pointer_helper
421 template<
typename _Tp,
typename _Cp>
422 struct __is_member_function_pointer_helper<_Tp _Cp::*>
423 :
public integral_constant<bool, is_function<_Tp>::value> { };
426 template<
typename _Tp>
428 :
public __is_member_function_pointer_helper<
429 typename remove_cv<_Tp>::type>
::type
433 template<
typename _Tp>
439 template<
typename _Tp>
445 template<
typename _Tp>
455 template<
typename _Res,
typename... _ArgTypes>
456 struct is_function<_Res(_ArgTypes...)>
459 template<
typename _Res,
typename... _ArgTypes>
460 struct is_function<_Res(_ArgTypes...) &>
463 template<
typename _Res,
typename... _ArgTypes>
464 struct is_function<_Res(_ArgTypes...) &&>
467 template<
typename _Res,
typename... _ArgTypes>
468 struct is_function<_Res(_ArgTypes......)>
471 template<
typename _Res,
typename... _ArgTypes>
472 struct is_function<_Res(_ArgTypes......) &>
475 template<
typename _Res,
typename... _ArgTypes>
476 struct is_function<_Res(_ArgTypes......) &&>
479 template<
typename _Res,
typename... _ArgTypes>
480 struct is_function<_Res(_ArgTypes...) const>
483 template<
typename _Res,
typename... _ArgTypes>
484 struct is_function<_Res(_ArgTypes...) const &>
487 template<
typename _Res,
typename... _ArgTypes>
488 struct is_function<_Res(_ArgTypes...) const &&>
491 template<
typename _Res,
typename... _ArgTypes>
492 struct is_function<_Res(_ArgTypes......) const>
495 template<
typename _Res,
typename... _ArgTypes>
496 struct is_function<_Res(_ArgTypes......) const &>
499 template<
typename _Res,
typename... _ArgTypes>
500 struct is_function<_Res(_ArgTypes......) const &&>
503 template<
typename _Res,
typename... _ArgTypes>
504 struct is_function<_Res(_ArgTypes...) volatile>
507 template<
typename _Res,
typename... _ArgTypes>
508 struct is_function<_Res(_ArgTypes...) volatile &>
511 template<
typename _Res,
typename... _ArgTypes>
512 struct is_function<_Res(_ArgTypes...) volatile &&>
515 template<
typename _Res,
typename... _ArgTypes>
516 struct is_function<_Res(_ArgTypes......) volatile>
519 template<
typename _Res,
typename... _ArgTypes>
520 struct is_function<_Res(_ArgTypes......) volatile &>
523 template<
typename _Res,
typename... _ArgTypes>
524 struct is_function<_Res(_ArgTypes......) volatile &&>
527 template<
typename _Res,
typename... _ArgTypes>
528 struct is_function<_Res(_ArgTypes...) const volatile>
531 template<
typename _Res,
typename... _ArgTypes>
532 struct is_function<_Res(_ArgTypes...) const volatile &>
535 template<
typename _Res,
typename... _ArgTypes>
536 struct is_function<_Res(_ArgTypes...) const volatile &&>
539 template<
typename _Res,
typename... _ArgTypes>
540 struct is_function<_Res(_ArgTypes......) const volatile>
543 template<
typename _Res,
typename... _ArgTypes>
544 struct is_function<_Res(_ArgTypes......) const volatile &>
547 template<
typename _Res,
typename... _ArgTypes>
548 struct is_function<_Res(_ArgTypes......) const volatile &&>
551 #define __cpp_lib_is_null_pointer 201309
554 struct __is_null_pointer_helper
558 struct __is_null_pointer_helper<std::nullptr_t>
562 template<
typename _Tp>
564 :
public __is_null_pointer_helper<typename remove_cv<_Tp>::type>::type
568 template<
typename _Tp>
576 template<
typename _Tp>
578 :
public __or_<is_lvalue_reference<_Tp>,
579 is_rvalue_reference<_Tp>>::type
583 template<
typename _Tp>
585 :
public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
589 template<
typename _Tp>
591 :
public __or_<is_arithmetic<_Tp>, is_void<_Tp>,
592 is_null_pointer<_Tp>>::type
596 template<
typename _Tp>
598 :
public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
606 template<
typename _Tp>
608 :
public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
609 is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type
613 template<
typename _Tp>
617 template<
typename _Tp>
618 struct __is_member_pointer_helper
621 template<
typename _Tp,
typename _Cp>
622 struct __is_member_pointer_helper<_Tp _Cp::*>
626 template<
typename _Tp>
627 struct is_member_pointer
628 :
public __is_member_pointer_helper<typename remove_cv<_Tp>::type>::type
633 template<
typename _Tp>
634 struct __is_referenceable
635 :
public __or_<is_object<_Tp>, is_reference<_Tp>>::type
638 template<
typename _Res,
typename... _Args>
639 struct __is_referenceable<_Res(_Args...)>
643 template<
typename _Res,
typename... _Args>
644 struct __is_referenceable<_Res(_Args......)>
655 template<
typename _Tp>
664 template<
typename _Tp>
669 template<
typename _Tp>
675 template<
typename _Tp>
676 struct is_trivially_copyable
681 template<
typename _Tp>
688 template<
typename _Tp>
694 template<
typename _Tp>
700 template<
typename _Tp>
706 template<
typename _Tp>
711 #if __cplusplus >= 201402L
712 #define __cpp_lib_is_final 201402L
714 template<
typename _Tp>
721 template<
typename _Tp>
726 template<
typename _Tp,
728 struct __is_signed_helper
731 template<
typename _Tp>
732 struct __is_signed_helper<_Tp, true>
733 :
public integral_constant<bool, _Tp(-1) < _Tp(0)>
737 template<typename _Tp>
739 : public __is_signed_helper<_Tp>::type
743 template<typename _Tp>
745 : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>
752 struct add_rvalue_reference;
758 template<typename _Tp>
759 typename add_rvalue_reference<_Tp>::type declval() noexcept;
761 template<typename, unsigned = 0>
765 struct remove_all_extents;
767 template<typename _Tp>
768 struct __is_array_known_bounds
769 : public integral_constant<bool, (extent<_Tp>::value > 0)>
772 template<
typename _Tp>
773 struct __is_array_unknown_bounds
774 :
public __and_<is_array<_Tp>, __not_<extent<_Tp>>>
782 struct __do_is_destructible_impl
784 template<
typename _Tp,
typename = decltype(declval<_Tp&>().~_Tp())>
791 template<
typename _Tp>
792 struct __is_destructible_impl
793 :
public __do_is_destructible_impl
795 typedef decltype(__test<_Tp>(0)) type;
798 template<typename _Tp,
799 bool = __or_<is_void<_Tp>,
800 __is_array_unknown_bounds<_Tp>,
801 is_function<_Tp>>::value,
802 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
803 struct __is_destructible_safe;
805 template<typename _Tp>
806 struct __is_destructible_safe<_Tp, false, false>
807 : public __is_destructible_impl<typename
808 remove_all_extents<_Tp>::type>::type
811 template<
typename _Tp>
812 struct __is_destructible_safe<_Tp, true, false>
815 template<
typename _Tp>
816 struct __is_destructible_safe<_Tp, false, true>
820 template<
typename _Tp>
821 struct is_destructible
822 :
public __is_destructible_safe<_Tp>::type
829 struct __do_is_nt_destructible_impl
831 template<
typename _Tp>
832 static integral_constant<bool, noexcept(declval<_Tp&>().~_Tp())>
839 template<
typename _Tp>
840 struct __is_nt_destructible_impl
841 :
public __do_is_nt_destructible_impl
843 typedef decltype(__test<_Tp>(0)) type;
846 template<typename _Tp,
847 bool = __or_<is_void<_Tp>,
848 __is_array_unknown_bounds<_Tp>,
849 is_function<_Tp>>::value,
850 bool = __or_<is_reference<_Tp>, is_scalar<_Tp>>::value>
851 struct __is_nt_destructible_safe;
853 template<typename _Tp>
854 struct __is_nt_destructible_safe<_Tp, false, false>
855 : public __is_nt_destructible_impl<typename
856 remove_all_extents<_Tp>::type>::type
859 template<
typename _Tp>
860 struct __is_nt_destructible_safe<_Tp, true, false>
863 template<
typename _Tp>
864 struct __is_nt_destructible_safe<_Tp, false, true>
868 template<
typename _Tp>
869 struct is_nothrow_destructible
870 :
public __is_nt_destructible_safe<_Tp>::type
873 struct __do_is_default_constructible_impl
875 template<
typename _Tp,
typename = decltype(_Tp())>
882 template<
typename _Tp>
883 struct __is_default_constructible_impl
884 :
public __do_is_default_constructible_impl
886 typedef decltype(__test<_Tp>(0)) type;
889 template<typename _Tp>
890 struct __is_default_constructible_atom
891 : public __and_<__not_<is_void<_Tp>>,
892 __is_default_constructible_impl<_Tp>>
895 template<typename _Tp, bool = is_array<_Tp>::value>
896 struct __is_default_constructible_safe;
903 template<
typename _Tp>
904 struct __is_default_constructible_safe<_Tp, true>
905 :
public __and_<__is_array_known_bounds<_Tp>,
906 __is_default_constructible_atom<typename
907 remove_all_extents<_Tp>::type>>
910 template<
typename _Tp>
911 struct __is_default_constructible_safe<_Tp, false>
912 :
public __is_default_constructible_atom<_Tp>::type
916 template<
typename _Tp>
917 struct is_default_constructible
918 :
public __is_default_constructible_safe<_Tp>::type
933 struct __do_is_static_castable_impl
935 template<
typename _From,
typename _To,
typename
936 = decltype(static_cast<_To>(declval<_From>()))>
939 template<
typename,
typename>
943 template<
typename _From,
typename _To>
944 struct __is_static_castable_impl
945 :
public __do_is_static_castable_impl
947 typedef decltype(__test<_From, _To>(0)) type;
950 template<typename _From, typename _To>
951 struct __is_static_castable_safe
952 : public __is_static_castable_impl<_From, _To>::type
956 template<
typename _From,
typename _To>
957 struct __is_static_castable
958 :
public integral_constant<bool, (__is_static_castable_safe<
967 struct __do_is_direct_constructible_impl
969 template<
typename _Tp,
typename _Arg,
typename
970 = decltype(::
new _Tp(declval<_Arg>()))>
973 template<
typename,
typename>
977 template<
typename _Tp,
typename _Arg>
978 struct __is_direct_constructible_impl
979 :
public __do_is_direct_constructible_impl
981 typedef decltype(__test<_Tp, _Arg>(0)) type;
984 template<typename _Tp, typename _Arg>
985 struct __is_direct_constructible_new_safe
986 : public __and_<is_destructible<_Tp>,
987 __is_direct_constructible_impl<_Tp, _Arg>>
990 template<
typename,
typename>
993 template<
typename,
typename>
997 struct remove_reference;
999 template<
typename _From,
typename _To,
bool
1000 = __not_<__or_<is_void<_From>,
1001 is_function<_From>>>::value>
1002 struct __is_base_to_derived_ref;
1004 template<
typename _Tp,
typename... _Args>
1005 struct is_constructible;
1009 template<
typename _From,
typename _To>
1010 struct __is_base_to_derived_ref<_From, _To, true>
1012 typedef typename remove_cv<
typename remove_reference<_From
1013 >::type>::type __src_t;
1014 typedef typename remove_cv<
typename remove_reference<_To
1015 >::type>::type __dst_t;
1016 typedef __and_<__not_<is_same<__src_t, __dst_t>>,
1017 is_base_of<__src_t, __dst_t>,
1018 __not_<is_constructible<__dst_t, _From>>> type;
1019 static constexpr
bool value = type::value;
1022 template<
typename _From,
typename _To>
1023 struct __is_base_to_derived_ref<_From, _To, false>
1027 template<
typename _From,
typename _To,
bool
1028 = __and_<is_lvalue_reference<_From>,
1029 is_rvalue_reference<_To>>::value>
1030 struct __is_lvalue_to_rvalue_ref;
1034 template<
typename _From,
typename _To>
1035 struct __is_lvalue_to_rvalue_ref<_From, _To, true>
1037 typedef typename remove_cv<
typename remove_reference<
1038 _From>::type>::type __src_t;
1039 typedef typename remove_cv<
typename remove_reference<
1040 _To>::type>::type __dst_t;
1041 typedef __and_<__not_<is_function<__src_t>>,
1042 __or_<is_same<__src_t, __dst_t>,
1043 is_base_of<__dst_t, __src_t>>> type;
1044 static constexpr
bool value = type::value;
1047 template<
typename _From,
typename _To>
1048 struct __is_lvalue_to_rvalue_ref<_From, _To, false>
1058 template<
typename _Tp,
typename _Arg>
1059 struct __is_direct_constructible_ref_cast
1060 :
public __and_<__is_static_castable<_Arg, _Tp>,
1061 __not_<__or_<__is_base_to_derived_ref<_Arg, _Tp>,
1062 __is_lvalue_to_rvalue_ref<_Arg, _Tp>
1066 template<
typename _Tp,
typename _Arg>
1067 struct __is_direct_constructible_new
1068 :
public conditional<is_reference<_Tp>::value,
1069 __is_direct_constructible_ref_cast<_Tp, _Arg>,
1070 __is_direct_constructible_new_safe<_Tp, _Arg>
1074 template<
typename _Tp,
typename _Arg>
1075 struct __is_direct_constructible
1076 :
public __is_direct_constructible_new<_Tp, _Arg>::type
1084 struct __do_is_nary_constructible_impl
1086 template<
typename _Tp,
typename... _Args,
typename
1087 = decltype(_Tp(declval<_Args>()...))>
1090 template<
typename,
typename...>
1094 template<
typename _Tp,
typename... _Args>
1095 struct __is_nary_constructible_impl
1096 :
public __do_is_nary_constructible_impl
1098 typedef decltype(__test<_Tp, _Args...>(0)) type;
1101 template<typename _Tp, typename... _Args>
1102 struct __is_nary_constructible
1103 : public __is_nary_constructible_impl<_Tp, _Args...>::type
1105 static_assert(
sizeof...(_Args) > 1,
1106 "Only useful for > 1 arguments");
1109 template<
typename _Tp,
typename... _Args>
1110 struct __is_constructible_impl
1111 :
public __is_nary_constructible<_Tp, _Args...>
1114 template<
typename _Tp,
typename _Arg>
1115 struct __is_constructible_impl<_Tp, _Arg>
1116 :
public __is_direct_constructible<_Tp, _Arg>
1119 template<
typename _Tp>
1120 struct __is_constructible_impl<_Tp>
1121 :
public is_default_constructible<_Tp>
1125 template<
typename _Tp,
typename... _Args>
1126 struct is_constructible
1127 :
public __is_constructible_impl<_Tp, _Args...>::type
1130 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1131 struct __is_copy_constructible_impl;
1133 template<
typename _Tp>
1134 struct __is_copy_constructible_impl<_Tp, false>
1137 template<
typename _Tp>
1138 struct __is_copy_constructible_impl<_Tp, true>
1139 :
public is_constructible<_Tp, const _Tp&>
1143 template<
typename _Tp>
1144 struct is_copy_constructible
1145 :
public __is_copy_constructible_impl<_Tp>
1148 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1149 struct __is_move_constructible_impl;
1151 template<
typename _Tp>
1152 struct __is_move_constructible_impl<_Tp, false>
1155 template<
typename _Tp>
1156 struct __is_move_constructible_impl<_Tp, true>
1157 :
public is_constructible<_Tp, _Tp&&>
1161 template<
typename _Tp>
1162 struct is_move_constructible
1163 :
public __is_move_constructible_impl<_Tp>
1166 template<
typename _Tp>
1167 struct __is_nt_default_constructible_atom
1168 :
public integral_constant<bool, noexcept(_Tp())>
1171 template<typename _Tp, bool = is_array<_Tp>::value>
1172 struct __is_nt_default_constructible_impl;
1174 template<
typename _Tp>
1175 struct __is_nt_default_constructible_impl<_Tp, true>
1176 :
public __and_<__is_array_known_bounds<_Tp>,
1177 __is_nt_default_constructible_atom<typename
1178 remove_all_extents<_Tp>::type>>
1181 template<
typename _Tp>
1182 struct __is_nt_default_constructible_impl<_Tp, false>
1183 :
public __is_nt_default_constructible_atom<_Tp>
1187 template<
typename _Tp>
1188 struct is_nothrow_default_constructible
1189 :
public __and_<is_default_constructible<_Tp>,
1190 __is_nt_default_constructible_impl<_Tp>>
1193 template<
typename _Tp,
typename... _Args>
1194 struct __is_nt_constructible_impl
1195 :
public integral_constant<bool, noexcept(_Tp(declval<_Args>()...))>
1198 template<
typename _Tp,
typename _Arg>
1199 struct __is_nt_constructible_impl<_Tp, _Arg>
1200 :
public integral_constant<bool,
1201 noexcept(static_cast<_Tp>(declval<_Arg>()))>
1204 template<
typename _Tp>
1205 struct __is_nt_constructible_impl<_Tp>
1206 :
public is_nothrow_default_constructible<_Tp>
1210 template<
typename _Tp,
typename... _Args>
1211 struct is_nothrow_constructible
1212 :
public __and_<is_constructible<_Tp, _Args...>,
1213 __is_nt_constructible_impl<_Tp, _Args...>>
1216 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1217 struct __is_nothrow_copy_constructible_impl;
1219 template<
typename _Tp>
1220 struct __is_nothrow_copy_constructible_impl<_Tp, false>
1223 template<
typename _Tp>
1224 struct __is_nothrow_copy_constructible_impl<_Tp, true>
1225 :
public is_nothrow_constructible<_Tp, const _Tp&>
1229 template<
typename _Tp>
1230 struct is_nothrow_copy_constructible
1231 :
public __is_nothrow_copy_constructible_impl<_Tp>
1234 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1235 struct __is_nothrow_move_constructible_impl;
1237 template<
typename _Tp>
1238 struct __is_nothrow_move_constructible_impl<_Tp, false>
1241 template<
typename _Tp>
1242 struct __is_nothrow_move_constructible_impl<_Tp, true>
1243 :
public is_nothrow_constructible<_Tp, _Tp&&>
1247 template<
typename _Tp>
1248 struct is_nothrow_move_constructible
1249 :
public __is_nothrow_move_constructible_impl<_Tp>
1252 template<
typename _Tp,
typename _Up>
1253 class __is_assignable_helper
1255 template<
typename _Tp1,
typename _Up1,
1256 typename = decltype(declval<_Tp1>() = declval<_Up1>())>
1260 template<
typename,
typename>
1265 typedef decltype(__test<_Tp, _Up>(0)) type;
1269 template<typename _Tp, typename _Up>
1270 struct is_assignable
1271 : public __is_assignable_helper<_Tp, _Up>::type
1274 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1275 struct __is_copy_assignable_impl;
1277 template<
typename _Tp>
1278 struct __is_copy_assignable_impl<_Tp, false>
1281 template<
typename _Tp>
1282 struct __is_copy_assignable_impl<_Tp, true>
1283 :
public is_assignable<_Tp&, const _Tp&>
1287 template<
typename _Tp>
1288 struct is_copy_assignable
1289 :
public __is_copy_assignable_impl<_Tp>
1292 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1293 struct __is_move_assignable_impl;
1295 template<
typename _Tp>
1296 struct __is_move_assignable_impl<_Tp, false>
1299 template<
typename _Tp>
1300 struct __is_move_assignable_impl<_Tp, true>
1301 :
public is_assignable<_Tp&, _Tp&&>
1305 template<
typename _Tp>
1306 struct is_move_assignable
1307 :
public __is_move_assignable_impl<_Tp>
1310 template<
typename _Tp,
typename _Up>
1311 struct __is_nt_assignable_impl
1312 :
public integral_constant<bool, noexcept(declval<_Tp>() = declval<_Up>())>
1316 template<
typename _Tp,
typename _Up>
1317 struct is_nothrow_assignable
1318 :
public __and_<is_assignable<_Tp, _Up>,
1319 __is_nt_assignable_impl<_Tp, _Up>>
1322 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1323 struct __is_nt_copy_assignable_impl;
1325 template<
typename _Tp>
1326 struct __is_nt_copy_assignable_impl<_Tp, false>
1329 template<
typename _Tp>
1330 struct __is_nt_copy_assignable_impl<_Tp, true>
1331 :
public is_nothrow_assignable<_Tp&, const _Tp&>
1335 template<
typename _Tp>
1336 struct is_nothrow_copy_assignable
1337 :
public __is_nt_copy_assignable_impl<_Tp>
1340 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1341 struct __is_nt_move_assignable_impl;
1343 template<
typename _Tp>
1344 struct __is_nt_move_assignable_impl<_Tp, false>
1347 template<
typename _Tp>
1348 struct __is_nt_move_assignable_impl<_Tp, true>
1349 :
public is_nothrow_assignable<_Tp&, _Tp&&>
1353 template<
typename _Tp>
1354 struct is_nothrow_move_assignable
1355 :
public __is_nt_move_assignable_impl<_Tp>
1359 template<
typename _Tp,
typename... _Args>
1360 struct is_trivially_constructible
1361 :
public __and_<is_constructible<_Tp, _Args...>, integral_constant<bool,
1362 __is_trivially_constructible(_Tp, _Args...)>>
1366 template<
typename _Tp>
1367 struct is_trivially_default_constructible
1368 :
public is_trivially_constructible<_Tp>::type
1371 struct __do_is_implicitly_default_constructible_impl
1373 template <
typename _Tp>
1374 static void __helper(
const _Tp&);
1376 template <
typename _Tp>
1378 decltype(__helper<const _Tp&>({}))* = 0);
1383 template<
typename _Tp>
1384 struct __is_implicitly_default_constructible_impl
1385 :
public __do_is_implicitly_default_constructible_impl
1387 typedef decltype(__test(declval<_Tp>())) type;
1390 template<typename _Tp>
1391 struct __is_implicitly_default_constructible_safe
1392 : public __is_implicitly_default_constructible_impl<_Tp>::type
1395 template <
typename _Tp>
1396 struct __is_implicitly_default_constructible
1397 :
public __and_<is_default_constructible<_Tp>,
1398 __is_implicitly_default_constructible_safe<_Tp>>
1402 template<
typename _Tp>
1403 struct is_trivially_copy_constructible
1404 :
public __and_<is_copy_constructible<_Tp>,
1405 integral_constant<bool,
1406 __is_trivially_constructible(_Tp, const _Tp&)>>
1410 template<
typename _Tp>
1411 struct is_trivially_move_constructible
1412 :
public __and_<is_move_constructible<_Tp>,
1413 integral_constant<bool,
1414 __is_trivially_constructible(_Tp, _Tp&&)>>
1418 template<
typename _Tp,
typename _Up>
1419 struct is_trivially_assignable
1420 :
public __and_<is_assignable<_Tp, _Up>,
1421 integral_constant<bool,
1422 __is_trivially_assignable(_Tp, _Up)>>
1426 template<
typename _Tp>
1427 struct is_trivially_copy_assignable
1428 :
public __and_<is_copy_assignable<_Tp>,
1429 integral_constant<bool,
1430 __is_trivially_assignable(_Tp&, const _Tp&)>>
1434 template<
typename _Tp>
1435 struct is_trivially_move_assignable
1436 :
public __and_<is_move_assignable<_Tp>,
1437 integral_constant<bool,
1438 __is_trivially_assignable(_Tp&, _Tp&&)>>
1442 template<
typename _Tp>
1443 struct is_trivially_destructible
1444 :
public __and_<is_destructible<_Tp>, integral_constant<bool,
1445 __has_trivial_destructor(_Tp)>>
1449 template<
typename _Tp>
1450 struct has_trivial_default_constructor
1451 :
public integral_constant<bool, __has_trivial_constructor(_Tp)>
1452 { } _GLIBCXX_DEPRECATED;
1455 template<
typename _Tp>
1456 struct has_trivial_copy_constructor
1457 :
public integral_constant<bool, __has_trivial_copy(_Tp)>
1458 { } _GLIBCXX_DEPRECATED;
1461 template<
typename _Tp>
1462 struct has_trivial_copy_assign
1463 :
public integral_constant<bool, __has_trivial_assign(_Tp)>
1464 { } _GLIBCXX_DEPRECATED;
1467 template<
typename _Tp>
1468 struct has_virtual_destructor
1469 :
public integral_constant<bool, __has_virtual_destructor(_Tp)>
1476 template<
typename _Tp>
1478 :
public integral_constant<std::size_t, __alignof__(_Tp)> { };
1483 :
public integral_constant<std::size_t, 0> { };
1485 template<
typename _Tp, std::
size_t _Size>
1486 struct rank<_Tp[_Size]>
1487 :
public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1489 template<
typename _Tp>
1491 :
public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1494 template<
typename,
unsigned _U
int>
1496 :
public integral_constant<std::size_t, 0> { };
1498 template<
typename _Tp,
unsigned _U
int, std::
size_t _Size>
1499 struct extent<_Tp[_Size], _Uint>
1500 :
public integral_constant<std::size_t,
1501 _Uint == 0 ? _Size : extent<_Tp,
1505 template<
typename _Tp,
unsigned _U
int>
1506 struct extent<_Tp[], _Uint>
1507 :
public integral_constant<std::size_t,
1508 _Uint == 0 ? 0 : extent<_Tp,
1516 template<
typename,
typename>
1520 template<
typename _Tp>
1521 struct is_same<_Tp, _Tp>
1525 template<
typename _Base,
typename _Derived>
1527 :
public integral_constant<bool, __is_base_of(_Base, _Derived)>
1530 template<
typename _From,
typename _To,
1531 bool = __or_<is_void<_From>, is_function<_To>,
1532 is_array<_To>>::value>
1533 struct __is_convertible_helper
1534 {
typedef typename is_void<_To>::type type; };
1536 template<
typename _From,
typename _To>
1537 class __is_convertible_helper<_From, _To, false>
1539 template<
typename _To1>
1540 static void __test_aux(_To1);
1542 template<
typename _From1,
typename _To1,
1543 typename = decltype(__test_aux<_To1>(std::declval<_From1>()))>
1547 template<
typename,
typename>
1552 typedef decltype(__test<_From, _To>(0)) type;
1557 template<typename _From, typename _To>
1558 struct is_convertible
1559 : public __is_convertible_helper<_From, _To>::type
1566 template<
typename _Tp>
1568 {
typedef _Tp type; };
1570 template<
typename _Tp>
1571 struct remove_const<_Tp const>
1572 {
typedef _Tp type; };
1575 template<
typename _Tp>
1576 struct remove_volatile
1577 {
typedef _Tp type; };
1579 template<
typename _Tp>
1580 struct remove_volatile<_Tp volatile>
1581 {
typedef _Tp type; };
1584 template<
typename _Tp>
1588 remove_const<typename remove_volatile<_Tp>::type>::type type;
1592 template<
typename _Tp>
1594 {
typedef _Tp
const type; };
1597 template<
typename _Tp>
1599 {
typedef _Tp
volatile type; };
1602 template<
typename _Tp>
1606 add_const<typename add_volatile<_Tp>::type>::type type;
1609 #if __cplusplus > 201103L
1611 #define __cpp_lib_transformation_trait_aliases 201304
1614 template<
typename _Tp>
1615 using remove_const_t =
typename remove_const<_Tp>::type;
1618 template<
typename _Tp>
1619 using remove_volatile_t =
typename remove_volatile<_Tp>::type;
1622 template<
typename _Tp>
1623 using remove_cv_t =
typename remove_cv<_Tp>::type;
1626 template<
typename _Tp>
1627 using add_const_t =
typename add_const<_Tp>::type;
1630 template<
typename _Tp>
1631 using add_volatile_t =
typename add_volatile<_Tp>::type;
1634 template<
typename _Tp>
1635 using add_cv_t =
typename add_cv<_Tp>::type;
1641 template<
typename _Tp>
1642 struct remove_reference
1643 {
typedef _Tp type; };
1645 template<
typename _Tp>
1646 struct remove_reference<_Tp&>
1647 {
typedef _Tp type; };
1649 template<
typename _Tp>
1650 struct remove_reference<_Tp&&>
1651 {
typedef _Tp type; };
1653 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1654 struct __add_lvalue_reference_helper
1655 {
typedef _Tp type; };
1657 template<
typename _Tp>
1658 struct __add_lvalue_reference_helper<_Tp, true>
1659 {
typedef _Tp& type; };
1662 template<
typename _Tp>
1663 struct add_lvalue_reference
1664 :
public __add_lvalue_reference_helper<_Tp>
1667 template<typename _Tp, bool = __is_referenceable<_Tp>::value>
1668 struct __add_rvalue_reference_helper
1669 {
typedef _Tp type; };
1671 template<
typename _Tp>
1672 struct __add_rvalue_reference_helper<_Tp, true>
1673 {
typedef _Tp&& type; };
1676 template<
typename _Tp>
1677 struct add_rvalue_reference
1678 :
public __add_rvalue_reference_helper<_Tp>
1681 #if __cplusplus > 201103L
1683 template<
typename _Tp>
1684 using remove_reference_t =
typename remove_reference<_Tp>::type;
1687 template<
typename _Tp>
1688 using add_lvalue_reference_t =
typename add_lvalue_reference<_Tp>::type;
1691 template<
typename _Tp>
1692 using add_rvalue_reference_t =
typename add_rvalue_reference<_Tp>::type;
1698 template<
typename _Unqualified,
bool _IsConst,
bool _IsVol>
1699 struct __cv_selector;
1701 template<
typename _Unqualified>
1702 struct __cv_selector<_Unqualified, false, false>
1703 {
typedef _Unqualified __type; };
1705 template<
typename _Unqualified>
1706 struct __cv_selector<_Unqualified, false, true>
1707 {
typedef volatile _Unqualified __type; };
1709 template<
typename _Unqualified>
1710 struct __cv_selector<_Unqualified, true, false>
1711 {
typedef const _Unqualified __type; };
1713 template<
typename _Unqualified>
1714 struct __cv_selector<_Unqualified, true, true>
1715 {
typedef const volatile _Unqualified __type; };
1717 template<
typename _Qualified,
typename _Unqualified,
1718 bool _IsConst = is_const<_Qualified>::value,
1719 bool _IsVol = is_volatile<_Qualified>::value>
1720 class __match_cv_qualifiers
1722 typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match;
1725 typedef typename __match::__type __type;
1729 template<
typename _Tp>
1730 struct __make_unsigned
1731 {
typedef _Tp __type; };
1734 struct __make_unsigned<char>
1735 {
typedef unsigned char __type; };
1738 struct __make_unsigned<signed char>
1739 {
typedef unsigned char __type; };
1742 struct __make_unsigned<short>
1743 {
typedef unsigned short __type; };
1746 struct __make_unsigned<int>
1747 {
typedef unsigned int __type; };
1750 struct __make_unsigned<long>
1751 {
typedef unsigned long __type; };
1754 struct __make_unsigned<long long>
1755 {
typedef unsigned long long __type; };
1757 #if defined(_GLIBCXX_USE_WCHAR_T) && !defined(__WCHAR_UNSIGNED__)
1759 struct __make_unsigned<wchar_t> : __make_unsigned<__WCHAR_TYPE__>
1763 #if defined(__GLIBCXX_TYPE_INT_N_0)
1765 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_0>
1766 {
typedef unsigned __GLIBCXX_TYPE_INT_N_0 __type; };
1768 #if defined(__GLIBCXX_TYPE_INT_N_1)
1770 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_1>
1771 {
typedef unsigned __GLIBCXX_TYPE_INT_N_1 __type; };
1773 #if defined(__GLIBCXX_TYPE_INT_N_2)
1775 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_2>
1776 {
typedef unsigned __GLIBCXX_TYPE_INT_N_2 __type; };
1778 #if defined(__GLIBCXX_TYPE_INT_N_3)
1780 struct __make_unsigned<__GLIBCXX_TYPE_INT_N_3>
1781 {
typedef unsigned __GLIBCXX_TYPE_INT_N_3 __type; };
1785 template<
typename _Tp,
1786 bool _IsInt = is_integral<_Tp>::value,
1787 bool _IsEnum = is_enum<_Tp>::value>
1788 class __make_unsigned_selector;
1790 template<
typename _Tp>
1791 class __make_unsigned_selector<_Tp, true, false>
1793 typedef __make_unsigned<typename remove_cv<_Tp>::type> __unsignedt;
1794 typedef typename __unsignedt::__type __unsigned_type;
1795 typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned;
1798 typedef typename __cv_unsigned::__type __type;
1801 template<
typename _Tp>
1802 class __make_unsigned_selector<_Tp, false, true>
1805 typedef unsigned char __smallest;
1806 static const bool __b0 =
sizeof(_Tp) <=
sizeof(__smallest);
1807 static const bool __b1 =
sizeof(_Tp) <=
sizeof(
unsigned short);
1808 static const bool __b2 =
sizeof(_Tp) <=
sizeof(
unsigned int);
1809 static const bool __b3 =
sizeof(_Tp) <=
sizeof(
unsigned long);
1810 typedef conditional<__b3, unsigned long, unsigned long long> __cond3;
1811 typedef typename __cond3::type __cond3_type;
1812 typedef conditional<__b2, unsigned int, __cond3_type> __cond2;
1813 typedef typename __cond2::type __cond2_type;
1814 typedef conditional<__b1, unsigned short, __cond2_type> __cond1;
1815 typedef typename __cond1::type __cond1_type;
1817 typedef typename conditional<__b0, __smallest, __cond1_type>::type
1819 typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned;
1822 typedef typename __cv_unsigned::__type __type;
1829 template<
typename _Tp>
1830 struct make_unsigned
1831 {
typedef typename __make_unsigned_selector<_Tp>::__type type; };
1835 struct make_unsigned<bool>;
1839 template<
typename _Tp>
1840 struct __make_signed
1841 {
typedef _Tp __type; };
1844 struct __make_signed<char>
1845 {
typedef signed char __type; };
1848 struct __make_signed<unsigned char>
1849 {
typedef signed char __type; };
1852 struct __make_signed<unsigned short>
1853 {
typedef signed short __type; };
1856 struct __make_signed<unsigned int>
1857 {
typedef signed int __type; };
1860 struct __make_signed<unsigned long>
1861 {
typedef signed long __type; };
1864 struct __make_signed<unsigned long long>
1865 {
typedef signed long long __type; };
1867 #if defined(_GLIBCXX_USE_WCHAR_T) && defined(__WCHAR_UNSIGNED__)
1869 struct __make_signed<wchar_t> : __make_signed<__WCHAR_TYPE__>
1873 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
1875 struct __make_signed<char16_t> : __make_signed<uint_least16_t>
1878 struct __make_signed<char32_t> : __make_signed<uint_least32_t>
1882 #if defined(__GLIBCXX_TYPE_INT_N_0)
1884 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_0>
1885 {
typedef __GLIBCXX_TYPE_INT_N_0 __type; };
1887 #if defined(__GLIBCXX_TYPE_INT_N_1)
1889 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_1>
1890 {
typedef __GLIBCXX_TYPE_INT_N_1 __type; };
1892 #if defined(__GLIBCXX_TYPE_INT_N_2)
1894 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_2>
1895 {
typedef __GLIBCXX_TYPE_INT_N_2 __type; };
1897 #if defined(__GLIBCXX_TYPE_INT_N_3)
1899 struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_3>
1900 {
typedef __GLIBCXX_TYPE_INT_N_3 __type; };
1904 template<
typename _Tp,
1905 bool _IsInt = is_integral<_Tp>::value,
1906 bool _IsEnum = is_enum<_Tp>::value>
1907 class __make_signed_selector;
1909 template<
typename _Tp>
1910 class __make_signed_selector<_Tp, true, false>
1912 typedef __make_signed<typename remove_cv<_Tp>::type> __signedt;
1913 typedef typename __signedt::__type __signed_type;
1914 typedef __match_cv_qualifiers<_Tp, __signed_type> __cv_signed;
1917 typedef typename __cv_signed::__type __type;
1920 template<
typename _Tp>
1921 class __make_signed_selector<_Tp, false, true>
1923 typedef typename __make_unsigned_selector<_Tp>::__type __unsigned_type;
1926 typedef typename __make_signed_selector<__unsigned_type>::__type __type;
1933 template<
typename _Tp>
1935 {
typedef typename __make_signed_selector<_Tp>::__type type; };
1939 struct make_signed<bool>;
1941 #if __cplusplus > 201103L
1943 template<
typename _Tp>
1944 using make_signed_t =
typename make_signed<_Tp>::type;
1947 template<
typename _Tp>
1948 using make_unsigned_t =
typename make_unsigned<_Tp>::type;
1954 template<
typename _Tp>
1955 struct remove_extent
1956 {
typedef _Tp type; };
1958 template<
typename _Tp, std::
size_t _Size>
1959 struct remove_extent<_Tp[_Size]>
1960 {
typedef _Tp type; };
1962 template<
typename _Tp>
1963 struct remove_extent<_Tp[]>
1964 {
typedef _Tp type; };
1967 template<
typename _Tp>
1968 struct remove_all_extents
1969 {
typedef _Tp type; };
1971 template<
typename _Tp, std::
size_t _Size>
1972 struct remove_all_extents<_Tp[_Size]>
1973 {
typedef typename remove_all_extents<_Tp>::type type; };
1975 template<
typename _Tp>
1976 struct remove_all_extents<_Tp[]>
1977 {
typedef typename remove_all_extents<_Tp>::type type; };
1979 #if __cplusplus > 201103L
1981 template<
typename _Tp>
1982 using remove_extent_t =
typename remove_extent<_Tp>::type;
1985 template<
typename _Tp>
1986 using remove_all_extents_t =
typename remove_all_extents<_Tp>::type;
1991 template<
typename _Tp,
typename>
1992 struct __remove_pointer_helper
1993 {
typedef _Tp type; };
1995 template<
typename _Tp,
typename _Up>
1996 struct __remove_pointer_helper<_Tp, _Up*>
1997 {
typedef _Up type; };
2000 template<
typename _Tp>
2001 struct remove_pointer
2002 :
public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type>
2006 template<
typename _Tp,
bool = __or_<__is_referenceable<_Tp>,
2007 is_
void<_Tp>>::value>
2008 struct __add_pointer_helper
2009 {
typedef _Tp type; };
2011 template<
typename _Tp>
2012 struct __add_pointer_helper<_Tp, true>
2013 {
typedef typename remove_reference<_Tp>::type* type; };
2015 template<
typename _Tp>
2017 :
public __add_pointer_helper<_Tp>
2020 #if __cplusplus > 201103L
2022 template<
typename _Tp>
2023 using remove_pointer_t =
typename remove_pointer<_Tp>::type;
2026 template<
typename _Tp>
2027 using add_pointer_t =
typename add_pointer<_Tp>::type;
2030 template<std::
size_t _Len>
2031 struct __aligned_storage_msa
2035 unsigned char __data[_Len];
2036 struct __attribute__((__aligned__)) { } __align;
2050 template<std::size_t _Len, std::size_t _Align =
2051 __alignof__(
typename __aligned_storage_msa<_Len>::__type)>
2052 struct aligned_storage
2056 unsigned char __data[_Len];
2057 struct __attribute__((__aligned__((_Align)))) { } __align;
2061 template <
typename... _Types>
2062 struct __strictest_alignment
2064 static const size_t _S_alignment = 0;
2065 static const size_t _S_size = 0;
2068 template <
typename _Tp,
typename... _Types>
2069 struct __strictest_alignment<_Tp, _Types...>
2071 static const size_t _S_alignment =
2072 alignof(_Tp) > __strictest_alignment<_Types...>::_S_alignment
2073 ?
alignof(_Tp) : __strictest_alignment<_Types...>::_S_alignment;
2074 static const size_t _S_size =
2075 sizeof(_Tp) > __strictest_alignment<_Types...>::_S_size
2076 ?
sizeof(_Tp) : __strictest_alignment<_Types...>::_S_size;
2089 template <
size_t _Len,
typename... _Types>
2090 struct aligned_union
2093 static_assert(
sizeof...(_Types) != 0,
"At least one type is required");
2095 using __strictest = __strictest_alignment<_Types...>;
2096 static const size_t _S_len = _Len > __strictest::_S_size
2097 ? _Len : __strictest::_S_size;
2100 static const size_t alignment_value = __strictest::_S_alignment;
2102 typedef typename aligned_storage<_S_len, alignment_value>::type type;
2105 template <
size_t _Len,
typename... _Types>
2106 const size_t aligned_union<_Len, _Types...>::alignment_value;
2110 template<
typename _Up,
2111 bool _IsArray = is_array<_Up>::value,
2112 bool _IsFunction = is_function<_Up>::value>
2113 struct __decay_selector;
2116 template<
typename _Up>
2117 struct __decay_selector<_Up, false, false>
2118 {
typedef typename remove_cv<_Up>::type __type; };
2120 template<
typename _Up>
2121 struct __decay_selector<_Up, true, false>
2122 {
typedef typename remove_extent<_Up>::type* __type; };
2124 template<
typename _Up>
2125 struct __decay_selector<_Up, false, true>
2126 {
typedef typename add_pointer<_Up>::type __type; };
2129 template<
typename _Tp>
2132 typedef typename remove_reference<_Tp>::type __remove_type;
2135 typedef typename __decay_selector<__remove_type>::__type type;
2138 template<
typename _Tp>
2139 class reference_wrapper;
2142 template<
typename _Tp>
2143 struct __strip_reference_wrapper
2148 template<
typename _Tp>
2149 struct __strip_reference_wrapper<reference_wrapper<_Tp> >
2151 typedef _Tp& __type;
2154 template<
typename _Tp>
2155 struct __decay_and_strip
2157 typedef typename __strip_reference_wrapper<
2158 typename decay<_Tp>::type>::__type __type;
2164 template<
bool,
typename _Tp =
void>
2169 template<
typename _Tp>
2170 struct enable_if<true, _Tp>
2171 {
typedef _Tp type; };
2173 template<
typename... _Cond>
2174 using _Require =
typename enable_if<__and_<_Cond...>::value>::type;
2178 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
2180 {
typedef _Iftrue type; };
2183 template<
typename _Iftrue,
typename _Iffalse>
2184 struct conditional<false, _Iftrue, _Iffalse>
2185 {
typedef _Iffalse type; };
2188 template<
typename... _Tp>
2193 struct __do_common_type_impl
2195 template<
typename _Tp,
typename _Up>
2196 static __success_type<
typename decay<decltype
2197 (
true ? std::declval<_Tp>()
2198 : std::declval<_Up>())>::type> _S_test(
int);
2200 template<
typename,
typename>
2201 static __failure_type _S_test(...);
2204 template<
typename _Tp,
typename _Up>
2205 struct __common_type_impl
2206 :
private __do_common_type_impl
2208 typedef decltype(_S_test<_Tp, _Up>(0)) type;
2211 struct __do_member_type_wrapper
2213 template<
typename _Tp>
2214 static __success_type<typename _Tp::type> _S_test(
int);
2217 static __failure_type _S_test(...);
2220 template<
typename _Tp>
2221 struct __member_type_wrapper
2222 :
private __do_member_type_wrapper
2224 typedef decltype(_S_test<_Tp>(0)) type;
2227 template<typename _CTp, typename... _Args>
2228 struct __expanded_common_type_wrapper
2230 typedef common_type<
typename _CTp::type, _Args...> type;
2233 template<
typename... _Args>
2234 struct __expanded_common_type_wrapper<__failure_type, _Args...>
2235 {
typedef __failure_type type; };
2237 template<
typename _Tp>
2238 struct common_type<_Tp>
2239 {
typedef typename decay<_Tp>::type type; };
2241 template<
typename _Tp,
typename _Up>
2242 struct common_type<_Tp, _Up>
2243 :
public __common_type_impl<_Tp, _Up>::type
2246 template<
typename _Tp,
typename _Up,
typename... _Vp>
2247 struct common_type<_Tp, _Up, _Vp...>
2248 :
public __expanded_common_type_wrapper<typename __member_type_wrapper<
2249 common_type<_Tp, _Up>>::type, _Vp...>::type
2253 template<
typename _Tp>
2254 struct underlying_type
2256 typedef __underlying_type(_Tp) type;
2259 template<typename _Tp>
2260 struct __declval_protector
2262 static const bool __stop =
false;
2263 static typename add_rvalue_reference<_Tp>::type __delegate();
2266 template<
typename _Tp>
2267 inline typename add_rvalue_reference<_Tp>::type
2270 static_assert(__declval_protector<_Tp>::__stop,
2271 "declval() must not be used!");
2272 return __declval_protector<_Tp>::__delegate();
2276 template<
typename _Signature>
2281 #define __cpp_lib_result_of_sfinae 201210
2283 struct __invoke_memfun_ref { };
2284 struct __invoke_memfun_deref { };
2285 struct __invoke_memobj_ref { };
2286 struct __invoke_memobj_deref { };
2287 struct __invoke_other { };
2290 template<
typename _Tp,
typename _Tag>
2291 struct __result_of_success : __success_type<_Tp>
2292 {
using __invoke_type = _Tag; };
2295 struct __result_of_memfun_ref_impl
2297 template<
typename _Fp,
typename _Tp1,
typename... _Args>
2298 static __result_of_success<decltype(
2299 (std::declval<_Tp1>().*std::declval<_Fp>())(std::declval<_Args>()...)
2300 ), __invoke_memfun_ref> _S_test(
int);
2302 template<
typename...>
2303 static __failure_type _S_test(...);
2306 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2307 struct __result_of_memfun_ref
2308 :
private __result_of_memfun_ref_impl
2310 typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type;
2314 struct __result_of_memfun_deref_impl
2316 template<
typename _Fp,
typename _Tp1,
typename... _Args>
2317 static __result_of_success<decltype(
2318 ((*std::declval<_Tp1>()).*std::declval<_Fp>())(std::declval<_Args>()...)
2319 ), __invoke_memfun_deref> _S_test(
int);
2321 template<
typename...>
2322 static __failure_type _S_test(...);
2325 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2326 struct __result_of_memfun_deref
2327 :
private __result_of_memfun_deref_impl
2329 typedef decltype(_S_test<_MemPtr, _Arg, _Args...>(0)) type;
2333 struct __result_of_memobj_ref_impl
2335 template<
typename _Fp,
typename _Tp1>
2336 static __result_of_success<decltype(
2337 std::declval<_Tp1>().*std::declval<_Fp>()
2338 ), __invoke_memobj_ref> _S_test(
int);
2340 template<
typename,
typename>
2341 static __failure_type _S_test(...);
2344 template<
typename _MemPtr,
typename _Arg>
2345 struct __result_of_memobj_ref
2346 :
private __result_of_memobj_ref_impl
2348 typedef decltype(_S_test<_MemPtr, _Arg>(0)) type;
2352 struct __result_of_memobj_deref_impl
2354 template<
typename _Fp,
typename _Tp1>
2355 static __result_of_success<decltype(
2356 (*std::declval<_Tp1>()).*std::declval<_Fp>()
2357 ), __invoke_memobj_deref> _S_test(
int);
2359 template<
typename,
typename>
2360 static __failure_type _S_test(...);
2363 template<
typename _MemPtr,
typename _Arg>
2364 struct __result_of_memobj_deref
2365 :
private __result_of_memobj_deref_impl
2367 typedef decltype(_S_test<_MemPtr, _Arg>(0)) type;
2370 template<typename _MemPtr, typename _Arg>
2371 struct __result_of_memobj;
2373 template<typename _Res, typename _Class, typename _Arg>
2374 struct __result_of_memobj<_Res _Class::*, _Arg>
2376 typedef typename remove_cv<
typename remove_reference<
2377 _Arg>::type>::type _Argval;
2378 typedef _Res _Class::* _MemPtr;
2379 typedef typename conditional<__or_<is_same<_Argval, _Class>,
2380 is_base_of<_Class, _Argval>>::value,
2381 __result_of_memobj_ref<_MemPtr, _Arg>,
2382 __result_of_memobj_deref<_MemPtr, _Arg>
2386 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2387 struct __result_of_memfun;
2389 template<
typename _Res,
typename _Class,
typename _Arg,
typename... _Args>
2390 struct __result_of_memfun<_Res _Class::*, _Arg, _Args...>
2392 typedef typename remove_cv<
typename remove_reference<
2393 _Arg>::type>::type _Argval;
2394 typedef _Res _Class::* _MemPtr;
2395 typedef typename conditional<__or_<is_same<_Argval, _Class>,
2396 is_base_of<_Class, _Argval>>::value,
2397 __result_of_memfun_ref<_MemPtr, _Arg, _Args...>,
2398 __result_of_memfun_deref<_MemPtr, _Arg, _Args...>
2406 template<
typename _Res,
typename _Class,
typename _Arg>
2407 struct __result_of_memobj<_Res _Class::*, reference_wrapper<_Arg>>
2408 : __result_of_memobj_ref<_Res _Class::*, _Arg&>
2411 template<
typename _Res,
typename _Class,
typename _Arg>
2412 struct __result_of_memobj<_Res _Class::*, reference_wrapper<_Arg>&>
2413 : __result_of_memobj_ref<_Res _Class::*, _Arg&>
2416 template<
typename _Res,
typename _Class,
typename _Arg>
2417 struct __result_of_memobj<_Res _Class::*, const reference_wrapper<_Arg>&>
2418 : __result_of_memobj_ref<_Res _Class::*, _Arg&>
2421 template<
typename _Res,
typename _Class,
typename _Arg>
2422 struct __result_of_memobj<_Res _Class::*, reference_wrapper<_Arg>&&>
2423 : __result_of_memobj_ref<_Res _Class::*, _Arg&>
2426 template<
typename _Res,
typename _Class,
typename _Arg>
2427 struct __result_of_memobj<_Res _Class::*, const reference_wrapper<_Arg>&&>
2428 : __result_of_memobj_ref<_Res _Class::*, _Arg&>
2431 template<
typename _Res,
typename _Class,
typename _Arg,
typename... _Args>
2432 struct __result_of_memfun<_Res _Class::*, reference_wrapper<_Arg>, _Args...>
2433 : __result_of_memfun_ref<_Res _Class::*, _Arg&, _Args...>
2436 template<
typename _Res,
typename _Class,
typename _Arg,
typename... _Args>
2437 struct __result_of_memfun<_Res _Class::*, reference_wrapper<_Arg>&,
2439 : __result_of_memfun_ref<_Res _Class::*, _Arg&, _Args...>
2442 template<
typename _Res,
typename _Class,
typename _Arg,
typename... _Args>
2443 struct __result_of_memfun<_Res _Class::*, const reference_wrapper<_Arg>&,
2445 : __result_of_memfun_ref<_Res _Class::*, _Arg&, _Args...>
2448 template<
typename _Res,
typename _Class,
typename _Arg,
typename... _Args>
2449 struct __result_of_memfun<_Res _Class::*, reference_wrapper<_Arg>&&,
2451 : __result_of_memfun_ref<_Res _Class::*, _Arg&, _Args...>
2454 template<
typename _Res,
typename _Class,
typename _Arg,
typename... _Args>
2455 struct __result_of_memfun<_Res _Class::*, const reference_wrapper<_Arg>&&,
2457 : __result_of_memfun_ref<_Res _Class::*, _Arg&, _Args...>
2460 template<bool, bool,
typename _Functor,
typename... _ArgTypes>
2461 struct __result_of_impl
2463 typedef __failure_type type;
2466 template<
typename _MemPtr,
typename _Arg>
2467 struct __result_of_impl<true, false, _MemPtr, _Arg>
2468 :
public __result_of_memobj<typename decay<_MemPtr>::type, _Arg>
2471 template<
typename _MemPtr,
typename _Arg,
typename... _Args>
2472 struct __result_of_impl<false, true, _MemPtr, _Arg, _Args...>
2473 :
public __result_of_memfun<typename decay<_MemPtr>::type, _Arg, _Args...>
2477 struct __result_of_other_impl
2479 template<
typename _Fn,
typename... _Args>
2480 static __result_of_success<decltype(
2481 std::declval<_Fn>()(std::declval<_Args>()...)
2482 ), __invoke_other> _S_test(
int);
2484 template<
typename...>
2485 static __failure_type _S_test(...);
2488 template<
typename _Functor,
typename... _ArgTypes>
2489 struct __result_of_impl<false, false, _Functor, _ArgTypes...>
2490 :
private __result_of_other_impl
2492 typedef decltype(_S_test<_Functor, _ArgTypes...>(0)) type;
2495 template<typename _Functor, typename... _ArgTypes>
2496 struct result_of<_Functor(_ArgTypes...)>
2497 : public __result_of_impl<
2498 is_member_object_pointer<
2499 typename remove_reference<_Functor>::type
2501 is_member_function_pointer<
2502 typename remove_reference<_Functor>::type
2504 _Functor, _ArgTypes...
2508 #if __cplusplus > 201103L
2510 template<
size_t _Len,
size_t _Align =
2511 __alignof__(
typename __aligned_storage_msa<_Len>::__type)>
2512 using aligned_storage_t =
typename aligned_storage<_Len, _Align>::type;
2514 template <
size_t _Len,
typename... _Types>
2515 using aligned_union_t =
typename aligned_union<_Len, _Types...>::type;
2518 template<
typename _Tp>
2519 using decay_t =
typename decay<_Tp>::type;
2522 template<
bool _Cond,
typename _Tp =
void>
2523 using enable_if_t =
typename enable_if<_Cond, _Tp>::type;
2526 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
2527 using conditional_t =
typename conditional<_Cond, _Iftrue, _Iffalse>::type;
2530 template<
typename... _Tp>
2531 using common_type_t =
typename common_type<_Tp...>::type;
2534 template<
typename _Tp>
2535 using underlying_type_t =
typename underlying_type<_Tp>::type;
2538 template<
typename _Tp>
2539 using result_of_t =
typename result_of<_Tp>::type;
2542 template<
typename...>
using __void_t = void;
2544 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
2545 #define __cpp_lib_void_t 201411
2547 template<
typename...>
using void_t = void;
2551 template<
typename _Default,
typename _AlwaysVoid,
2552 template<
typename...>
class _Op,
typename... _Args>
2556 using type = _Default;
2560 template<
typename _Default,
template<
typename...>
class _Op,
2562 struct __detector<_Default, __void_t<_Op<_Args...>>, _Op, _Args...>
2565 using type = _Op<_Args...>;
2569 template<
typename _Default,
template<
typename...>
class _Op,
2571 using __detected_or = __detector<_Default, void, _Op, _Args...>;
2574 template<
typename _Default,
template<
typename...>
class _Op,
2576 using __detected_or_t
2577 =
typename __detected_or<_Default, _Op, _Args...>::type;
2585 #define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
2586 template<typename _Tp, typename = __void_t<>> \
2587 struct __has_##_NTYPE \
2590 template<typename _Tp> \
2591 struct __has_##_NTYPE<_Tp, __void_t<typename _Tp::_NTYPE>> \
2595 template <
typename _Tp>
2596 struct __is_swappable;
2598 template <
typename _Tp>
2599 struct __is_nothrow_swappable;
2601 template<
typename _Tp>
2603 typename enable_if<__and_<is_move_constructible<_Tp>,
2604 is_move_assignable<_Tp>>::value>::type
2606 noexcept(__and_<is_nothrow_move_constructible<_Tp>,
2607 is_nothrow_move_assignable<_Tp>>::value);
2609 template<typename _Tp,
size_t _Nm>
2611 typename enable_if<__is_swappable<_Tp>::value>::type
2612 swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
2613 noexcept(__is_nothrow_swappable<_Tp>::value);
2615 namespace __swappable_details {
2618 struct __do_is_swappable_impl
2620 template<
typename _Tp,
typename
2621 = decltype(
swap(std::declval<_Tp&>(), std::declval<_Tp&>()))>
2628 struct __do_is_nothrow_swappable_impl
2630 template<
typename _Tp>
2631 static __bool_constant<
2632 noexcept(
swap(std::declval<_Tp&>(), std::declval<_Tp&>()))
2641 template<
typename _Tp>
2642 struct __is_swappable_impl
2643 :
public __swappable_details::__do_is_swappable_impl
2645 typedef decltype(__test<_Tp>(0)) type;
2648 template<typename _Tp>
2649 struct __is_nothrow_swappable_impl
2650 : public __swappable_details::__do_is_nothrow_swappable_impl
2652 typedef decltype(__test<_Tp>(0)) type;
2655 template<typename _Tp>
2656 struct __is_swappable
2657 : public __is_swappable_impl<_Tp>::type
2660 template<
typename _Tp>
2661 struct __is_nothrow_swappable
2662 :
public __is_nothrow_swappable_impl<_Tp>::type
2665 _GLIBCXX_END_NAMESPACE_VERSION
2670 #endif // _GLIBCXX_TYPE_TRAITS
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
void swap(basic_filebuf< _CharT, _Traits > &__x, basic_filebuf< _CharT, _Traits > &__y)
Swap specialization for filebufs.
is_null_pointer (LWG 2247).
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
is_member_function_pointer
__is_nullptr_t (extension).