29 #ifndef _EXT_TYPE_TRAITS
30 #define _EXT_TYPE_TRAITS 1
32 #pragma GCC system_header
37 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
40 template<
bool, typename>
44 template<
typename _Tp>
45 struct __enable_if<true, _Tp>
46 {
typedef _Tp __type; };
50 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
51 struct __conditional_type
52 {
typedef _Iftrue __type; };
54 template<
typename _Iftrue,
typename _Iffalse>
55 struct __conditional_type<false, _Iftrue, _Iffalse>
56 {
typedef _Iffalse __type; };
60 template<
typename _Tp>
64 typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
67 typedef typename __if_type::__type __type;
71 struct __add_unsigned<char>
72 {
typedef unsigned char __type; };
75 struct __add_unsigned<signed char>
76 {
typedef unsigned char __type; };
79 struct __add_unsigned<short>
80 {
typedef unsigned short __type; };
83 struct __add_unsigned<int>
84 {
typedef unsigned int __type; };
87 struct __add_unsigned<long>
88 {
typedef unsigned long __type; };
91 struct __add_unsigned<long long>
92 {
typedef unsigned long long __type; };
96 struct __add_unsigned<bool>;
99 struct __add_unsigned<wchar_t>;
103 template<
typename _Tp>
104 struct __remove_unsigned
107 typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
110 typedef typename __if_type::__type __type;
114 struct __remove_unsigned<char>
115 {
typedef signed char __type; };
118 struct __remove_unsigned<unsigned char>
119 {
typedef signed char __type; };
122 struct __remove_unsigned<unsigned short>
123 {
typedef short __type; };
126 struct __remove_unsigned<unsigned int>
127 {
typedef int __type; };
130 struct __remove_unsigned<unsigned long>
131 {
typedef long __type; };
134 struct __remove_unsigned<unsigned long long>
135 {
typedef long long __type; };
139 struct __remove_unsigned<bool>;
142 struct __remove_unsigned<wchar_t>;
146 template<
typename _Type>
148 __is_null_pointer(_Type* __ptr)
149 {
return __ptr == 0; }
151 template<
typename _Type>
153 __is_null_pointer(_Type)
158 template<typename _Tp, bool = std::__is_integer<_Tp>::__value>
160 {
typedef double __type; };
162 template<
typename _Tp>
163 struct __promote<_Tp, false>
164 {
typedef _Tp __type; };
166 template<
typename _Tp,
typename _Up>
170 typedef typename __promote<_Tp>::__type __type1;
171 typedef typename __promote<_Up>::__type __type2;
174 typedef __typeof__(__type1() + __type2()) __type;
177 template<typename _Tp, typename _Up, typename _Vp>
181 typedef typename __promote<_Tp>::__type __type1;
182 typedef typename __promote<_Up>::__type __type2;
183 typedef typename __promote<_Vp>::__type __type3;
186 typedef __typeof__(__type1() + __type2() + __type3()) __type;
189 template<typename _Tp, typename _Up, typename _Vp, typename _Wp>
193 typedef typename __promote<_Tp>::__type __type1;
194 typedef typename __promote<_Up>::__type __type2;
195 typedef typename __promote<_Vp>::__type __type3;
196 typedef typename __promote<_Wp>::__type __type4;
199 typedef __typeof__(__type1() + __type2() + __type3() + __type4()) __type;
202 _GLIBCXX_END_NAMESPACE