29#ifndef _EXT_TYPE_TRAITS
30#define _EXT_TYPE_TRAITS 1
32#pragma GCC system_header
39namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
41_GLIBCXX_BEGIN_NAMESPACE_VERSION
44 template<
bool,
typename>
48 template<
typename _Tp>
49 struct __enable_if<true, _Tp>
50 {
typedef _Tp __type; };
54 template<
bool _Cond,
typename _Iftrue,
typename _Iffalse>
55 struct __conditional_type
56 {
typedef _Iftrue __type; };
58 template<
typename _Iftrue,
typename _Iffalse>
59 struct __conditional_type<false, _Iftrue, _Iffalse>
60 {
typedef _Iffalse __type; };
64 template<
typename _Tp>
68 typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
71 typedef typename __if_type::__type __type;
75 struct __add_unsigned<char>
76 {
typedef unsigned char __type; };
79 struct __add_unsigned<signed char>
80 {
typedef unsigned char __type; };
83 struct __add_unsigned<short>
84 {
typedef unsigned short __type; };
87 struct __add_unsigned<int>
88 {
typedef unsigned int __type; };
91 struct __add_unsigned<long>
92 {
typedef unsigned long __type; };
95 struct __add_unsigned<long long>
96 {
typedef unsigned long long __type; };
100 struct __add_unsigned<bool>;
103 struct __add_unsigned<wchar_t>;
107 template<
typename _Tp>
108 struct __remove_unsigned
111 typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;
114 typedef typename __if_type::__type __type;
118 struct __remove_unsigned<char>
119 {
typedef signed char __type; };
122 struct __remove_unsigned<unsigned char>
123 {
typedef signed char __type; };
126 struct __remove_unsigned<unsigned short>
127 {
typedef short __type; };
130 struct __remove_unsigned<unsigned int>
131 {
typedef int __type; };
134 struct __remove_unsigned<unsigned long>
135 {
typedef long __type; };
138 struct __remove_unsigned<unsigned long long>
139 {
typedef long long __type; };
143 struct __remove_unsigned<bool>;
146 struct __remove_unsigned<wchar_t>;
150 template<
typename _Type>
153 __is_null_pointer(_Type* __ptr)
154 {
return __ptr == 0; }
156 template<
typename _Type>
159 __is_null_pointer(_Type)
162#if __cplusplus >= 201103L
164 __is_null_pointer(std::nullptr_t)
170 template<typename _Tp, bool = std::__is_integer<_Tp>::__value>
172 {
typedef double __type; };
177 template<
typename _Tp>
178 struct __promote<_Tp, false>
182 struct __promote<long double>
183 {
typedef long double __type; };
186 struct __promote<double>
187 {
typedef double __type; };
190 struct __promote<float>
191 {
typedef float __type; };
193#if __cpp_fold_expressions
195 template<
typename... _Tp>
196 using __promoted_t =
decltype((
typename __promote<_Tp>::__type(0) + ...));
200 template<
typename _Tp,
typename _Up>
201 using __promote_2 = __promote<__promoted_t<_Tp, _Up>>;
203 template<
typename _Tp,
typename _Up,
typename _Vp>
204 using __promote_3 = __promote<__promoted_t<_Tp, _Up, _Vp>>;
206 template<
typename _Tp,
typename _Up,
typename _Vp,
typename _Wp>
207 using __promote_4 = __promote<__promoted_t<_Tp, _Up, _Vp, _Wp>>;
211 template<
typename _Tp,
typename _Up,
212 typename _Tp2 =
typename __promote<_Tp>::__type,
213 typename _Up2 =
typename __promote<_Up>::__type>
216 typedef __typeof__(_Tp2() + _Up2()) __type;
219 template<typename _Tp, typename _Up, typename _Vp,
220 typename _Tp2 = typename __promote<_Tp>::__type,
221 typename _Up2 = typename __promote<_Up>::__type,
222 typename _Vp2 = typename __promote<_Vp>::__type>
225 typedef __typeof__(_Tp2() + _Up2() + _Vp2()) __type;
228 template<typename _Tp, typename _Up, typename _Vp, typename _Wp,
229 typename _Tp2 = typename __promote<_Tp>::__type,
230 typename _Up2 = typename __promote<_Up>::__type,
231 typename _Vp2 = typename __promote<_Vp>::__type,
232 typename _Wp2 = typename __promote<_Wp>::__type>
235 typedef __typeof__(_Tp2() + _Up2() + _Vp2() + _Wp2()) __type;
239_GLIBCXX_END_NAMESPACE_VERSION
GNU extensions for public use.