29 #ifndef _GLIBCXX_TYPE_TRAITS
30 #define _GLIBCXX_TYPE_TRAITS 1
32 #pragma GCC system_header
34 #ifndef __GXX_EXPERIMENTAL_CXX0X__
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() {
return value; }
71 template<
typename _Tp, _Tp __v>
76 template<
bool,
typename,
typename>
87 template<
typename _B1>
92 template<
typename _B1,
typename _B2>
93 struct __or_<_B1, _B2>
94 :
public conditional<_B1::value, _B1, _B2>::type
97 template<
typename _B1,
typename _B2,
typename _B3,
typename... _Bn>
98 struct __or_<_B1, _B2, _B3, _Bn...>
99 :
public conditional<_B1::value, _B1, __or_<_B2, _B3, _Bn...>>::type
102 template<
typename...>
110 template<
typename _B1>
115 template<
typename _B1,
typename _B2>
116 struct __and_<_B1, _B2>
117 :
public conditional<_B1::value, _B2, _B1>::type
120 template<
typename _B1,
typename _B2,
typename _B3,
typename... _Bn>
121 struct __and_<_B1, _B2, _B3, _Bn...>
122 :
public conditional<_B1::value, __and_<_B2, _B3, _Bn...>, _B1>::type
125 template<
typename _Pp>
127 :
public integral_constant<bool, !_Pp::value>
130 struct __sfinae_types
133 typedef struct {
char __arr[2]; } __two;
142 struct __is_void_helper
146 struct __is_void_helper<void>
150 template<
typename _Tp>
153 remove_cv<_Tp>::type>::value)>
157 struct __is_integral_helper
161 struct __is_integral_helper<bool>
165 struct __is_integral_helper<char>
169 struct __is_integral_helper<signed char>
173 struct __is_integral_helper<unsigned char>
176 #ifdef _GLIBCXX_USE_WCHAR_T
178 struct __is_integral_helper<wchar_t>
183 struct __is_integral_helper<char16_t>
187 struct __is_integral_helper<char32_t>
191 struct __is_integral_helper<short>
195 struct __is_integral_helper<unsigned short>
199 struct __is_integral_helper<int>
203 struct __is_integral_helper<unsigned int>
207 struct __is_integral_helper<long>
211 struct __is_integral_helper<unsigned long>
215 struct __is_integral_helper<long long>
219 struct __is_integral_helper<unsigned long long>
222 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
224 struct __is_integral_helper<__int128>
228 struct __is_integral_helper<unsigned __int128>
233 template<
typename _Tp>
236 remove_cv<_Tp>::type>::value)>
240 struct __is_floating_point_helper
244 struct __is_floating_point_helper<float>
248 struct __is_floating_point_helper<double>
252 struct __is_floating_point_helper<long double>
255 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
257 struct __is_floating_point_helper<__float128>
262 template<
typename _Tp>
265 remove_cv<_Tp>::type>::value)>
273 template<
typename _Tp, std::
size_t _Size>
277 template<
typename _Tp>
278 struct is_array<_Tp[]>
282 struct __is_pointer_helper
285 template<
typename _Tp>
286 struct __is_pointer_helper<_Tp*>
290 template<
typename _Tp>
293 remove_cv<_Tp>::type>::value)>
301 template<
typename _Tp>
310 template<
typename _Tp>
318 struct __is_member_object_pointer_helper
321 template<
typename _Tp,
typename _Cp>
322 struct __is_member_object_pointer_helper<_Tp _Cp::*>
326 template<
typename _Tp>
329 typename remove_cv<_Tp>::type>::value)>
333 struct __is_member_function_pointer_helper
336 template<
typename _Tp,
typename _Cp>
337 struct __is_member_function_pointer_helper<_Tp _Cp::*>
338 :
public integral_constant<bool, is_function<_Tp>::value> { };
341 template<
typename _Tp>
344 typename remove_cv<_Tp>::type>::value)>
348 template<
typename _Tp>
354 template<
typename _Tp>
360 template<
typename _Tp>
370 template<
typename _Res,
typename... _ArgTypes>
371 struct is_function<_Res(_ArgTypes...)>
374 template<
typename _Res,
typename... _ArgTypes>
375 struct is_function<_Res(_ArgTypes......)>
378 template<
typename _Res,
typename... _ArgTypes>
379 struct is_function<_Res(_ArgTypes...) const>
382 template<
typename _Res,
typename... _ArgTypes>
383 struct is_function<_Res(_ArgTypes......) const>
386 template<
typename _Res,
typename... _ArgTypes>
387 struct is_function<_Res(_ArgTypes...) volatile>
390 template<
typename _Res,
typename... _ArgTypes>
391 struct is_function<_Res(_ArgTypes......) volatile>
394 template<
typename _Res,
typename... _ArgTypes>
395 struct is_function<_Res(_ArgTypes...) const volatile>
398 template<
typename _Res,
typename... _ArgTypes>
399 struct is_function<_Res(_ArgTypes......) const volatile>
403 struct __is_nullptr_t_helper
407 struct __is_nullptr_t_helper<std::nullptr_t>
411 template<
typename _Tp>
412 struct __is_nullptr_t
413 :
public integral_constant<bool, (__is_nullptr_t_helper<typename
414 remove_cv<_Tp>::type>::value)>
420 template<
typename _Tp>
422 :
public __or_<is_lvalue_reference<_Tp>,
423 is_rvalue_reference<_Tp>>::type
427 template<
typename _Tp>
429 :
public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
433 template<
typename _Tp>
435 :
public __or_<is_arithmetic<_Tp>, is_void<_Tp>>::type
439 template<
typename _Tp>
441 :
public __not_<__or_<is_function<_Tp>, is_reference<_Tp>,
449 template<
typename _Tp>
451 :
public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
452 is_member_pointer<_Tp>, __is_nullptr_t<_Tp>>::type
456 template<
typename _Tp>
460 template<
typename _Tp>
461 struct __is_member_pointer_helper
464 template<
typename _Tp,
typename _Cp>
465 struct __is_member_pointer_helper<_Tp _Cp::*>
469 template<
typename _Tp>
470 struct is_member_pointer
471 :
public integral_constant<bool, (__is_member_pointer_helper<
472 typename remove_cv<_Tp>::type>::value)>
482 template<
typename _Tp>
491 template<
typename _Tp>
496 template<
typename _Tp>
504 template<
typename _Tp>
511 template<
typename _Tp>
517 template<
typename _Tp>
523 template<
typename _Tp>
529 template<
typename _Tp>
535 template<
typename _Tp>
540 template<
typename _Tp,
543 struct __is_signed_helper
546 template<
typename _Tp>
547 struct __is_signed_helper<_Tp, false, true>
550 template<
typename _Tp>
551 struct __is_signed_helper<_Tp, true, false>
552 :
public integral_constant<bool, static_cast<bool>(_Tp(-1) < _Tp(0))>
556 template<typename _Tp>
558 : public integral_constant<bool, __is_signed_helper<_Tp>::value>
562 template<typename _Tp>
564 : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type
571 struct add_rvalue_reference;
577 template<typename _Tp>
578 typename add_rvalue_reference<_Tp>::type declval() noexcept;
580 template<typename, unsigned = 0>
584 struct remove_all_extents;
586 template<typename _Tp>
587 struct __is_array_known_bounds
588 : public integral_constant<bool, (extent<_Tp>::value > 0)>
591 template<
typename _Tp>
592 struct __is_array_unknown_bounds
593 :
public __and_<is_array<_Tp>, __not_<extent<_Tp>>>::type
601 struct __do_is_destructible_impl_1
603 template<
typename _Up>
604 struct __w { _Up __u; };
606 template<
typename _Tp,
typename
607 = decltype(
declval<__w<_Tp>&>().~__w<_Tp>())>
614 template<
typename _Tp>
615 struct __is_destructible_impl_1
616 :
public __do_is_destructible_impl_1
618 typedef decltype(__test<_Tp>(0)) type;
622 struct __do_is_destructible_impl_2
624 template<
typename _Tp,
typename = decltype(declval<_Tp&>().~_Tp())>
631 template<
typename _Tp>
632 struct __is_destructible_impl_2
633 :
public __do_is_destructible_impl_2
635 typedef decltype(__test<_Tp>(0)) type;
638 template<typename _Tp,
639 bool = __or_<is_void<_Tp>,
640 __is_array_unknown_bounds<_Tp>>::value,
641 bool = __or_<is_reference<_Tp>, is_function<_Tp>>::value>
642 struct __is_destructible_safe;
644 template<typename _Tp>
645 struct __is_destructible_safe<_Tp, false, false>
646 : public conditional<is_abstract<_Tp>::value,
647 __is_destructible_impl_2<_Tp>,
648 __is_destructible_impl_1<_Tp>>::type::type
651 template<
typename _Tp>
652 struct __is_destructible_safe<_Tp, true, false>
655 template<
typename _Tp>
656 struct __is_destructible_safe<_Tp, false, true>
660 template<
typename _Tp>
665 struct __do_is_default_constructible_impl
667 template<
typename _Tp,
typename = decltype(_Tp())>
674 template<
typename _Tp>
675 struct __is_default_constructible_impl
676 :
public __do_is_default_constructible_impl
678 typedef decltype(__test<_Tp>(0)) type;
681 template<typename _Tp>
682 struct __is_default_constructible_atom
683 : public __and_<__not_<is_void<_Tp>>,
684 __is_default_constructible_impl<_Tp>>::type
687 template<typename _Tp, bool = is_array<_Tp>::value>
688 struct __is_default_constructible_safe;
695 template<
typename _Tp>
696 struct __is_default_constructible_safe<_Tp, true>
697 :
public __and_<__is_array_known_bounds<_Tp>,
698 __is_default_constructible_atom<typename
699 remove_all_extents<_Tp>::type>>::type
702 template<
typename _Tp>
703 struct __is_default_constructible_safe<_Tp, false>
704 :
public __is_default_constructible_atom<_Tp>::type
708 template<
typename _Tp>
726 struct __do_is_static_castable_impl
728 template<
typename _From,
typename _To,
typename
729 = decltype(static_cast<_To>(declval<_From>()))>
732 template<
typename,
typename>
736 template<
typename _From,
typename _To>
737 struct __is_static_castable_impl
738 :
public __do_is_static_castable_impl
740 typedef decltype(__test<_From, _To>(0)) type;
743 template<typename _From, typename _To>
744 struct __is_static_castable_safe
745 : public __is_static_castable_impl<_From, _To>::type
749 template<
typename _From,
typename _To>
750 struct __is_static_castable
751 :
public integral_constant<bool, (__is_static_castable_safe<
760 struct __do_is_direct_constructible_impl
762 template<
typename _Tp,
typename _Arg,
typename
763 = decltype(::
new _Tp(declval<_Arg>()))>
766 template<
typename,
typename>
770 template<
typename _Tp,
typename _Arg>
771 struct __is_direct_constructible_impl
772 :
public __do_is_direct_constructible_impl
774 typedef decltype(__test<_Tp, _Arg>(0)) type;
777 template<typename _Tp, typename _Arg>
778 struct __is_direct_constructible_new_safe
779 : public __and_<is_destructible<_Tp>,
780 __is_direct_constructible_impl<_Tp, _Arg>>::type
783 template<
typename,
typename>
786 template<
typename,
typename>
792 template<
typename _From,
typename _To,
bool
793 = __not_<__or_<is_void<_From>,
795 struct __is_base_to_derived_ref;
799 template<
typename _From,
typename _To>
800 struct __is_base_to_derived_ref<_From, _To, true>
803 >::type>::type __src_t;
805 >::type>::type __dst_t;
806 typedef __and_<__not_<is_same<__src_t, __dst_t>>,
808 static constexpr
bool value = type::value;
811 template<
typename _From,
typename _To>
812 struct __is_base_to_derived_ref<_From, _To, false>
816 template<
typename _From,
typename _To,
bool
817 = __and_<is_lvalue_reference<_From>,
818 is_rvalue_reference<_To>>::value>
819 struct __is_lvalue_to_rvalue_ref;
823 template<
typename _From,
typename _To>
824 struct __is_lvalue_to_rvalue_ref<_From, _To, true>
826 typedef typename remove_cv<
typename remove_reference<
827 _From>::type>::type __src_t;
828 typedef typename remove_cv<
typename remove_reference<
829 _To>::type>::type __dst_t;
830 typedef __and_<__not_<is_function<__src_t>>,
831 __or_<is_same<__src_t, __dst_t>,
832 is_base_of<__dst_t, __src_t>>> type;
833 static constexpr
bool value = type::value;
836 template<
typename _From,
typename _To>
837 struct __is_lvalue_to_rvalue_ref<_From, _To, false>
847 template<
typename _Tp,
typename _Arg>
848 struct __is_direct_constructible_ref_cast
849 :
public __and_<__is_static_castable<_Arg, _Tp>,
850 __not_<__or_<__is_base_to_derived_ref<_Arg, _Tp>,
851 __is_lvalue_to_rvalue_ref<_Arg, _Tp>
855 template<
typename _Tp,
typename _Arg>
856 struct __is_direct_constructible_new
857 :
public conditional<is_reference<_Tp>::value,
858 __is_direct_constructible_ref_cast<_Tp, _Arg>,
859 __is_direct_constructible_new_safe<_Tp, _Arg>
863 template<
typename _Tp,
typename _Arg>
864 struct __is_direct_constructible
865 :
public integral_constant<bool, (__is_direct_constructible_new<
874 struct __do_is_nary_constructible_impl
876 template<
typename _Tp,
typename... _Args,
typename
877 = decltype(_Tp(declval<_Args>()...))>
880 template<
typename,
typename...>
884 template<
typename _Tp,
typename... _Args>
885 struct __is_nary_constructible_impl
886 :
public __do_is_nary_constructible_impl
888 typedef decltype(__test<_Tp, _Args...>(0)) type;
891 template<typename _Tp, typename... _Args>
892 struct __is_nary_constructible
893 : public __is_nary_constructible_impl<_Tp, _Args...>::type
895 static_assert(
sizeof...(_Args) > 1,
896 "Only useful for > 1 arguments");
899 template<
typename _Tp,
typename... _Args>
900 struct __is_constructible_impl
901 :
public __is_nary_constructible<_Tp, _Args...>
904 template<
typename _Tp,
typename _Arg>
905 struct __is_constructible_impl<_Tp, _Arg>
906 :
public __is_direct_constructible<_Tp, _Arg>
909 template<
typename _Tp>
910 struct __is_constructible_impl<_Tp>
911 :
public is_default_constructible<_Tp>
915 template<
typename _Tp,
typename... _Args>
921 template<typename _Tp, bool = is_void<_Tp>::value>
922 struct __is_copy_constructible_impl;
924 template<
typename _Tp>
925 struct __is_copy_constructible_impl<_Tp, true>
928 template<
typename _Tp>
929 struct __is_copy_constructible_impl<_Tp, false>
930 :
public is_constructible<_Tp, const _Tp&>
934 template<
typename _Tp>
936 :
public __is_copy_constructible_impl<_Tp>
939 template<typename _Tp, bool = is_void<_Tp>::value>
940 struct __is_move_constructible_impl;
942 template<
typename _Tp>
943 struct __is_move_constructible_impl<_Tp, true>
946 template<
typename _Tp>
947 struct __is_move_constructible_impl<_Tp, false>
948 :
public is_constructible<_Tp, _Tp&&>
952 template<
typename _Tp>
954 :
public __is_move_constructible_impl<_Tp>
957 template<
typename _Tp>
958 struct __is_nt_default_constructible_atom
962 template<typename _Tp, bool = is_array<_Tp>::value>
963 struct __is_nt_default_constructible_impl;
965 template<
typename _Tp>
966 struct __is_nt_default_constructible_impl<_Tp, true>
967 :
public __and_<__is_array_known_bounds<_Tp>,
968 __is_nt_default_constructible_atom<typename
969 remove_all_extents<_Tp>::type>>::type
972 template<
typename _Tp>
973 struct __is_nt_default_constructible_impl<_Tp, false>
974 :
public __is_nt_default_constructible_atom<_Tp>
978 template<
typename _Tp>
980 :
public __and_<is_default_constructible<_Tp>,
981 __is_nt_default_constructible_impl<_Tp>>::type
984 template<
typename _Tp,
typename... _Args>
985 struct __is_nt_constructible_impl
989 template<
typename _Tp,
typename _Arg>
990 struct __is_nt_constructible_impl<_Tp, _Arg>
991 :
public integral_constant<bool,
992 noexcept(static_cast<_Tp>(declval<_Arg>()))>
995 template<
typename _Tp>
996 struct __is_nt_constructible_impl<_Tp>
997 :
public is_nothrow_default_constructible<_Tp>
1001 template<
typename _Tp,
typename... _Args>
1003 :
public __and_<is_constructible<_Tp, _Args...>,
1004 __is_nt_constructible_impl<_Tp, _Args...>>::type
1007 template<typename _Tp, bool = is_void<_Tp>::value>
1008 struct __is_nothrow_copy_constructible_impl;
1010 template<
typename _Tp>
1011 struct __is_nothrow_copy_constructible_impl<_Tp, true>
1014 template<
typename _Tp>
1015 struct __is_nothrow_copy_constructible_impl<_Tp, false>
1016 :
public is_nothrow_constructible<_Tp, const _Tp&>
1020 template<
typename _Tp>
1022 :
public __is_nothrow_copy_constructible_impl<_Tp>
1025 template<typename _Tp, bool = is_void<_Tp>::value>
1026 struct __is_nothrow_move_constructible_impl;
1028 template<
typename _Tp>
1029 struct __is_nothrow_move_constructible_impl<_Tp, true>
1032 template<
typename _Tp>
1033 struct __is_nothrow_move_constructible_impl<_Tp, false>
1034 :
public is_nothrow_constructible<_Tp, _Tp&&>
1038 template<
typename _Tp>
1040 :
public __is_nothrow_move_constructible_impl<_Tp>
1043 template<
typename _Tp,
typename _Up>
1044 class __is_assignable_helper
1045 :
public __sfinae_types
1047 template<
typename _Tp1,
typename _Up1>
1048 static decltype(declval<_Tp1>() = declval<_Up1>(), __one())
1051 template<typename, typename>
1052 static __two __test(...);
1055 static constexpr
bool value = sizeof(__test<_Tp, _Up>(0)) == 1;
1059 template<typename _Tp, typename _Up>
1062 __is_assignable_helper<_Tp, _Up>::value>
1065 template<typename _Tp, bool = is_void<_Tp>::value>
1066 struct __is_copy_assignable_impl;
1068 template<
typename _Tp>
1069 struct __is_copy_assignable_impl<_Tp, true>
1072 template<
typename _Tp>
1073 struct __is_copy_assignable_impl<_Tp, false>
1074 :
public is_assignable<_Tp&, const _Tp&>
1078 template<
typename _Tp>
1080 :
public __is_copy_assignable_impl<_Tp>
1083 template<typename _Tp, bool = is_void<_Tp>::value>
1084 struct __is_move_assignable_impl;
1086 template<
typename _Tp>
1087 struct __is_move_assignable_impl<_Tp, true>
1090 template<
typename _Tp>
1091 struct __is_move_assignable_impl<_Tp, false>
1092 :
public is_assignable<_Tp&, _Tp&&>
1096 template<
typename _Tp>
1098 :
public __is_move_assignable_impl<_Tp>
1101 template<
typename _Tp,
typename _Up>
1102 struct __is_nt_assignable_impl
1107 template<
typename _Tp,
typename _Up>
1109 :
public __and_<is_assignable<_Tp, _Up>,
1110 __is_nt_assignable_impl<_Tp, _Up>>::type
1113 template<typename _Tp, bool = is_void<_Tp>::value>
1114 struct __is_nt_copy_assignable_impl;
1116 template<
typename _Tp>
1117 struct __is_nt_copy_assignable_impl<_Tp, true>
1120 template<
typename _Tp>
1121 struct __is_nt_copy_assignable_impl<_Tp, false>
1122 :
public is_nothrow_assignable<_Tp&, const _Tp&>
1126 template<
typename _Tp>
1128 :
public __is_nt_copy_assignable_impl<_Tp>
1131 template<typename _Tp, bool = is_void<_Tp>::value>
1132 struct __is_nt_move_assignable_impl;
1134 template<
typename _Tp>
1135 struct __is_nt_move_assignable_impl<_Tp, true>
1138 template<
typename _Tp>
1139 struct __is_nt_move_assignable_impl<_Tp, false>
1140 :
public is_nothrow_assignable<_Tp&, _Tp&&>
1144 template<
typename _Tp>
1146 :
public __is_nt_move_assignable_impl<_Tp>
1150 template<
typename _Tp>
1156 template<
typename _Tp>
1162 template<
typename _Tp>
1168 template<
typename _Tp>
1174 template<
typename _Tp>
1183 template<
typename _Tp>
1192 template<
typename _Tp, std::
size_t _Size>
1193 struct rank<_Tp[_Size]>
1196 template<
typename _Tp>
1198 :
public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
1201 template<
typename,
unsigned _U
int>
1203 :
public integral_constant<std::size_t, 0> { };
1205 template<
typename _Tp,
unsigned _U
int, std::
size_t _Size>
1206 struct extent<_Tp[_Size], _Uint>
1207 :
public integral_constant<std::size_t,
1208 _Uint == 0 ? _Size : extent<_Tp,
1212 template<
typename _Tp,
unsigned _U
int>
1213 struct extent<_Tp[], _Uint>
1214 :
public integral_constant<std::size_t,
1215 _Uint == 0 ? 0 : extent<_Tp,
1223 template<
typename,
typename>
1227 template<
typename _Tp>
1228 struct is_same<_Tp, _Tp>
1232 template<
typename _Base,
typename _Derived>
1234 :
public integral_constant<bool, __is_base_of(_Base, _Derived)>
1237 template<
typename _From,
typename _To,
1238 bool = __or_<is_void<_From>, is_function<_To>,
1239 is_array<_To>>::value>
1240 struct __is_convertible_helper
1241 {
static constexpr
bool value = is_void<_To>::value; };
1243 template<
typename _From,
typename _To>
1244 class __is_convertible_helper<_From, _To, false>
1245 :
public __sfinae_types
1247 template<
typename _To1>
1248 static void __test_aux(_To1);
1250 template<
typename _From1,
typename _To1>
1251 static decltype(__test_aux<_To1>(std::declval<_From1>()), __one())
1254 template<typename, typename>
1255 static __two __test(...);
1258 static constexpr
bool value = sizeof(__test<_From, _To>(0)) == 1;
1262 template<typename _From, typename _To>
1265 __is_convertible_helper<_From, _To>::value>
1269 template<
typename _From,
typename _To>
1278 template<
typename _Tp>
1280 {
typedef _Tp type; };
1282 template<
typename _Tp>
1284 {
typedef _Tp type; };
1287 template<
typename _Tp>
1289 {
typedef _Tp type; };
1291 template<
typename _Tp>
1293 {
typedef _Tp type; };
1296 template<
typename _Tp>
1300 remove_const<typename remove_volatile<_Tp>::type>::type type;
1304 template<
typename _Tp>
1306 {
typedef _Tp
const type; };
1309 template<
typename _Tp>
1311 {
typedef _Tp
volatile type; };
1314 template<
typename _Tp>
1325 template<
typename _Tp>
1327 {
typedef _Tp type; };
1329 template<
typename _Tp>
1330 struct remove_reference<_Tp&>
1331 {
typedef _Tp type; };
1333 template<
typename _Tp>
1334 struct remove_reference<_Tp&&>
1335 {
typedef _Tp type; };
1337 template<
typename _Tp,
1338 bool = __and_<__not_<is_reference<_Tp>>,
1339 __not_<is_void<_Tp>>>::value,
1340 bool = is_rvalue_reference<_Tp>::value>
1341 struct __add_lvalue_reference_helper
1342 {
typedef _Tp type; };
1344 template<
typename _Tp>
1345 struct __add_lvalue_reference_helper<_Tp, true, false>
1346 {
typedef _Tp& type; };
1348 template<
typename _Tp>
1349 struct __add_lvalue_reference_helper<_Tp, false, true>
1350 {
typedef typename remove_reference<_Tp>::type& type; };
1353 template<
typename _Tp>
1355 :
public __add_lvalue_reference_helper<_Tp>
1358 template<
typename _Tp,
1359 bool = __and_<__not_<is_reference<_Tp>>,
1360 __not_<is_void<_Tp>>>::value>
1361 struct __add_rvalue_reference_helper
1362 {
typedef _Tp type; };
1364 template<
typename _Tp>
1365 struct __add_rvalue_reference_helper<_Tp, true>
1366 {
typedef _Tp&& type; };
1369 template<
typename _Tp>
1370 struct add_rvalue_reference
1371 :
public __add_rvalue_reference_helper<_Tp>
1378 template<
typename _Unqualified,
bool _IsConst,
bool _IsVol>
1379 struct __cv_selector;
1381 template<
typename _Unqualified>
1382 struct __cv_selector<_Unqualified, false, false>
1383 {
typedef _Unqualified __type; };
1385 template<
typename _Unqualified>
1386 struct __cv_selector<_Unqualified, false, true>
1387 {
typedef volatile _Unqualified __type; };
1389 template<
typename _Unqualified>
1390 struct __cv_selector<_Unqualified, true, false>
1391 {
typedef const _Unqualified __type; };
1393 template<
typename _Unqualified>
1394 struct __cv_selector<_Unqualified, true, true>
1395 {
typedef const volatile _Unqualified __type; };
1397 template<
typename _Qualified,
typename _Unqualified,
1398 bool _IsConst = is_const<_Qualified>::value,
1399 bool _IsVol = is_volatile<_Qualified>::value>
1400 class __match_cv_qualifiers
1402 typedef __cv_selector<_Unqualified, _IsConst, _IsVol> __match;
1405 typedef typename __match::__type __type;
1409 template<
typename _Tp>
1410 struct __make_unsigned
1411 {
typedef _Tp __type; };
1414 struct __make_unsigned<char>
1415 {
typedef unsigned char __type; };
1418 struct __make_unsigned<signed char>
1419 {
typedef unsigned char __type; };
1422 struct __make_unsigned<short>
1423 {
typedef unsigned short __type; };
1426 struct __make_unsigned<int>
1427 {
typedef unsigned int __type; };
1430 struct __make_unsigned<long>
1431 {
typedef unsigned long __type; };
1434 struct __make_unsigned<long long>
1435 {
typedef unsigned long long __type; };
1437 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
1439 struct __make_unsigned<__int128>
1440 {
typedef unsigned __int128 __type; };
1444 template<
typename _Tp,
1445 bool _IsInt = is_integral<_Tp>::value,
1446 bool _IsEnum = is_enum<_Tp>::value>
1447 class __make_unsigned_selector;
1449 template<
typename _Tp>
1450 class __make_unsigned_selector<_Tp, true, false>
1452 typedef __make_unsigned<typename remove_cv<_Tp>::type> __unsignedt;
1453 typedef typename __unsignedt::__type __unsigned_type;
1454 typedef __match_cv_qualifiers<_Tp, __unsigned_type> __cv_unsigned;
1457 typedef typename __cv_unsigned::__type __type;
1460 template<
typename _Tp>
1461 class __make_unsigned_selector<_Tp, false, true>
1464 typedef unsigned char __smallest;
1465 static const bool __b0 =
sizeof(_Tp) <=
sizeof(__smallest);
1466 static const bool __b1 =
sizeof(_Tp) <=
sizeof(
unsigned short);
1467 static const bool __b2 =
sizeof(_Tp) <=
sizeof(
unsigned int);
1468 typedef conditional<__b2, unsigned int, unsigned long> __cond2;
1469 typedef typename __cond2::type __cond2_type;
1470 typedef conditional<__b1, unsigned short, __cond2_type> __cond1;
1471 typedef typename __cond1::type __cond1_type;
1474 typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
1481 template<
typename _Tp>
1483 {
typedef typename __make_unsigned_selector<_Tp>::__type type; };
1491 template<
typename _Tp>
1492 struct __make_signed
1493 {
typedef _Tp __type; };
1496 struct __make_signed<char>
1497 {
typedef signed char __type; };
1500 struct __make_signed<unsigned char>
1501 {
typedef signed char __type; };
1504 struct __make_signed<unsigned short>
1505 {
typedef signed short __type; };
1508 struct __make_signed<unsigned int>
1509 {
typedef signed int __type; };
1512 struct __make_signed<unsigned long>
1513 {
typedef signed long __type; };
1516 struct __make_signed<unsigned long long>
1517 {
typedef signed long long __type; };
1519 #if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
1521 struct __make_signed<unsigned __int128>
1522 {
typedef __int128 __type; };
1526 template<
typename _Tp,
1527 bool _IsInt = is_integral<_Tp>::value,
1528 bool _IsEnum = is_enum<_Tp>::value>
1529 class __make_signed_selector;
1531 template<
typename _Tp>
1532 class __make_signed_selector<_Tp, true, false>
1534 typedef __make_signed<typename remove_cv<_Tp>::type> __signedt;
1535 typedef typename __signedt::__type __signed_type;
1536 typedef __match_cv_qualifiers<_Tp, __signed_type> __cv_signed;
1539 typedef typename __cv_signed::__type __type;
1542 template<
typename _Tp>
1543 class __make_signed_selector<_Tp, false, true>
1546 typedef signed char __smallest;
1547 static const bool __b0 =
sizeof(_Tp) <=
sizeof(__smallest);
1548 static const bool __b1 =
sizeof(_Tp) <=
sizeof(
signed short);
1549 static const bool __b2 =
sizeof(_Tp) <=
sizeof(
signed int);
1550 typedef conditional<__b2, signed int, signed long> __cond2;
1551 typedef typename __cond2::type __cond2_type;
1552 typedef conditional<__b1, signed short, __cond2_type> __cond1;
1553 typedef typename __cond1::type __cond1_type;
1556 typedef typename conditional<__b0, __smallest, __cond1_type>::type __type;
1563 template<
typename _Tp>
1565 {
typedef typename __make_signed_selector<_Tp>::__type type; };
1575 template<
typename _Tp>
1577 {
typedef _Tp type; };
1579 template<
typename _Tp, std::
size_t _Size>
1581 {
typedef _Tp type; };
1583 template<
typename _Tp>
1584 struct remove_extent<_Tp[]>
1585 {
typedef _Tp type; };
1588 template<
typename _Tp>
1589 struct remove_all_extents
1590 {
typedef _Tp type; };
1592 template<
typename _Tp, std::
size_t _Size>
1593 struct remove_all_extents<_Tp[_Size]>
1594 {
typedef typename remove_all_extents<_Tp>::type type; };
1596 template<
typename _Tp>
1597 struct remove_all_extents<_Tp[]>
1598 {
typedef typename remove_all_extents<_Tp>::type type; };
1603 template<
typename _Tp,
typename>
1604 struct __remove_pointer_helper
1605 {
typedef _Tp type; };
1607 template<
typename _Tp,
typename _Up>
1608 struct __remove_pointer_helper<_Tp, _Up*>
1609 {
typedef _Up type; };
1612 template<
typename _Tp>
1614 :
public __remove_pointer_helper<_Tp, typename remove_cv<_Tp>::type>
1618 template<
typename _Tp>
1620 {
typedef typename remove_reference<_Tp>::type* type; };
1623 template<std::
size_t _Len>
1624 struct __aligned_storage_msa
1628 unsigned char __data[_Len];
1629 struct __attribute__((__aligned__)) { } __align;
1643 template<std::size_t _Len, std::size_t _Align =
1644 __alignof__(
typename __aligned_storage_msa<_Len>::__type)>
1649 unsigned char __data[_Len];
1650 struct __attribute__((__aligned__((_Align)))) { } __align;
1657 template<
typename _Up,
1660 struct __decay_selector;
1663 template<
typename _Up>
1664 struct __decay_selector<_Up, false, false>
1665 {
typedef typename remove_cv<_Up>::type __type; };
1667 template<
typename _Up>
1668 struct __decay_selector<_Up, true, false>
1669 {
typedef typename remove_extent<_Up>::type* __type; };
1671 template<
typename _Up>
1672 struct __decay_selector<_Up, false, true>
1673 {
typedef typename add_pointer<_Up>::type __type; };
1676 template<
typename _Tp>
1679 typedef typename remove_reference<_Tp>::type __remove_type;
1682 typedef typename __decay_selector<__remove_type>::__type type;
1685 template<
typename _Tp>
1689 template<
typename _Tp>
1690 struct __strip_reference_wrapper
1695 template<
typename _Tp>
1696 struct __strip_reference_wrapper<reference_wrapper<_Tp> >
1698 typedef _Tp& __type;
1701 template<
typename _Tp>
1702 struct __strip_reference_wrapper<const reference_wrapper<_Tp> >
1704 typedef _Tp& __type;
1707 template<
typename _Tp>
1708 struct __decay_and_strip
1710 typedef typename __strip_reference_wrapper<
1711 typename decay<_Tp>::type>::__type __type;
1717 template<
bool,
typename _Tp =
void>
1722 template<
typename _Tp>
1724 {
typedef _Tp type; };
1729 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
1731 {
typedef _Iftrue type; };
1734 template<
typename _Iftrue,
typename _Iffalse>
1735 struct conditional<false, _Iftrue, _Iffalse>
1736 {
typedef _Iffalse type; };
1740 template<
typename... _Tp>
1743 template<
typename _Tp>
1745 {
typedef _Tp type; };
1747 template<
typename _Tp,
typename _Up>
1749 {
typedef decltype(
true ? declval<_Tp>() : declval<_Up>()) type; };
1751 template<typename _Tp, typename _Up, typename... _Vp>
1759 template<
typename _Tp>
1762 typedef __underlying_type(_Tp) type;
1765 template<
typename _Tp>
1766 struct __declval_protector
1768 static const bool __stop =
false;
1769 static typename add_rvalue_reference<_Tp>::type __delegate();
1772 template<
typename _Tp>
1773 inline typename add_rvalue_reference<_Tp>::type
1776 static_assert(__declval_protector<_Tp>::__stop,
1777 "declval() must not be used!");
1778 return __declval_protector<_Tp>::__delegate();
1782 template<
typename _Signature>
1785 template<
typename _MemPtr,
typename _Arg>
1786 struct _Result_of_memobj;
1788 template<
typename _Res,
typename _Class,
typename _Arg>
1789 struct _Result_of_memobj<_Res _Class::*, _Arg>
1792 typedef _Res _Class::* _Func;
1794 template<
typename _Tp>
1795 static _Tp _S_get(
const _Class&);
1796 template<
typename _Tp>
1797 static decltype(*std::declval<_Tp>()) _S_get(...);
1801 decltype(_S_get<_Arg>(std::
declval<_Arg>()).*std::
declval<_Func>())
1805 template<typename _MemPtr, typename _Arg, typename... _ArgTypes>
1806 struct _Result_of_memfun;
1808 template<typename _Res, typename _Class, typename _Arg, typename... _Args>
1809 struct _Result_of_memfun<_Res _Class::*, _Arg, _Args...>
1812 typedef _Res _Class::* _Func;
1814 template<
typename _Tp>
1815 static _Tp _S_get(
const _Class&);
1816 template<
typename _Tp>
1817 static decltype(*std::declval<_Tp>()) _S_get(...);
1821 decltype((_S_get<_Arg>(std::
declval<_Arg>()).*std::
declval<_Func>())
1826 template<
bool,
bool, typename _Functor, typename... _ArgTypes>
1827 struct _Result_of_impl;
1829 template<typename _Functor, typename... _ArgTypes>
1830 struct _Result_of_impl<false, false, _Functor, _ArgTypes...>
1833 decltype( std::declval<_Functor>()(std::declval<_ArgTypes>()...) )
1837 template<typename _MemPtr, typename _Arg>
1838 struct _Result_of_impl<true, false, _MemPtr, _Arg>
1841 typedef typename _Result_of_memobj<
1842 typename remove_reference<_MemPtr>::type, _Arg>::__type
1846 template<
typename _MemPtr,
typename _Arg,
typename... _ArgTypes>
1847 struct _Result_of_impl<false, true, _MemPtr, _Arg, _ArgTypes...>
1848 : _Result_of_memfun<typename remove_reference<_MemPtr>::type, _Arg,
1851 typedef typename _Result_of_memfun<
1852 typename remove_reference<_MemPtr>::type, _Arg, _ArgTypes...>::__type
1856 template<
typename _Functor,
typename... _ArgTypes>
1857 struct result_of<_Functor(_ArgTypes...)>
1858 : _Result_of_impl<is_member_object_pointer<
1859 typename remove_reference<_Functor>::type >::value,
1860 is_member_function_pointer<
1861 typename remove_reference<_Functor>::type >::value,
1862 _Functor, _ArgTypes...>
1864 typedef typename _Result_of_impl<
1865 is_member_object_pointer<
1866 typename remove_reference<_Functor>::type >::value,
1867 is_member_function_pointer<
1868 typename remove_reference<_Functor>::type >::value,
1869 _Functor, _ArgTypes...>::__type
1877 #define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \
1878 template<typename _Tp> \
1879 class __has_##_NTYPE##_helper \
1882 template<typename _Up> \
1886 template<typename _Up> \
1887 static __one __test(_Wrap_type<typename _Up::_NTYPE>*); \
1889 template<typename _Up> \
1890 static __two __test(...); \
1893 static constexpr bool value = sizeof(__test<_Tp>(0)) == 1; \
1896 template<typename _Tp> \
1897 struct __has_##_NTYPE \
1898 : integral_constant<bool, __has_##_NTYPE##_helper \
1899 <typename remove_cv<_Tp>::type>::value> \
1903 _GLIBCXX_END_NAMESPACE_VERSION
1906 #endif // __GXX_EXPERIMENTAL_CXX0X__
1908 #endif // _GLIBCXX_TYPE_TRAITS
is_explicitly_convertible
The underlying type of an enum.
has_trivial_copy_constructor
is_nothrow_copy_assignable
Define a member typedef type only if a boolean constant is true.
is_nothrow_move_assignable
is_nothrow_move_constructible
is_nothrow_default_constructible
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
Primary class template for reference_wrapper.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
Define a member typedef type to one of two argument types.
is_member_function_pointer
has_trivial_default_constructor
add_rvalue_reference< _Tp >::type declval() noexcept
Utility to simplify expressions used in unevaluated operands.
is_nothrow_copy_constructible