32 #ifndef _CPP_TYPE_TRAITS_H
33 #define _CPP_TYPE_TRAITS_H 1
35 #pragma GCC system_header
68 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
70 _GLIBCXX_BEGIN_NAMESPACE_VERSION
72 template<
typename _Iterator,
typename _Container>
73 class __normal_iterator;
75 _GLIBCXX_END_NAMESPACE_VERSION
78 namespace std _GLIBCXX_VISIBILITY(default)
80 _GLIBCXX_BEGIN_NAMESPACE_VERSION
82 struct __true_type { };
83 struct __false_type { };
87 {
typedef __false_type __type; };
90 struct __truth_type<true>
91 {
typedef __true_type __type; };
95 template<
class _Sp,
class _Tp>
98 enum { __value = bool(_Sp::__value) || bool(_Tp::__value) };
99 typedef typename __truth_type<__value>::__type __type;
103 template<
typename,
typename>
106 enum { __value = 0 };
107 typedef __false_type __type;
110 template<
typename _Tp>
111 struct __are_same<_Tp, _Tp>
113 enum { __value = 1 };
114 typedef __true_type __type;
118 template<
typename _Tp>
121 enum { __value = 0 };
122 typedef __false_type __type;
126 struct __is_void<void>
128 enum { __value = 1 };
129 typedef __true_type __type;
135 template<
typename _Tp>
138 enum { __value = 0 };
139 typedef __false_type __type;
146 struct __is_integer<bool>
148 enum { __value = 1 };
149 typedef __true_type __type;
153 struct __is_integer<char>
155 enum { __value = 1 };
156 typedef __true_type __type;
160 struct __is_integer<signed char>
162 enum { __value = 1 };
163 typedef __true_type __type;
167 struct __is_integer<unsigned char>
169 enum { __value = 1 };
170 typedef __true_type __type;
173 # ifdef _GLIBCXX_USE_WCHAR_T
175 struct __is_integer<wchar_t>
177 enum { __value = 1 };
178 typedef __true_type __type;
182 #if __cplusplus >= 201103L
184 struct __is_integer<char16_t>
186 enum { __value = 1 };
187 typedef __true_type __type;
191 struct __is_integer<char32_t>
193 enum { __value = 1 };
194 typedef __true_type __type;
199 struct __is_integer<short>
201 enum { __value = 1 };
202 typedef __true_type __type;
206 struct __is_integer<unsigned short>
208 enum { __value = 1 };
209 typedef __true_type __type;
213 struct __is_integer<int>
215 enum { __value = 1 };
216 typedef __true_type __type;
220 struct __is_integer<unsigned int>
222 enum { __value = 1 };
223 typedef __true_type __type;
227 struct __is_integer<long>
229 enum { __value = 1 };
230 typedef __true_type __type;
234 struct __is_integer<unsigned long>
236 enum { __value = 1 };
237 typedef __true_type __type;
241 struct __is_integer<long long>
243 enum { __value = 1 };
244 typedef __true_type __type;
248 struct __is_integer<unsigned long long>
250 enum { __value = 1 };
251 typedef __true_type __type;
257 template<
typename _Tp>
260 enum { __value = 0 };
261 typedef __false_type __type;
266 struct __is_floating<float>
268 enum { __value = 1 };
269 typedef __true_type __type;
273 struct __is_floating<double>
275 enum { __value = 1 };
276 typedef __true_type __type;
280 struct __is_floating<long double>
282 enum { __value = 1 };
283 typedef __true_type __type;
289 template<
typename _Tp>
292 enum { __value = 0 };
293 typedef __false_type __type;
296 template<
typename _Tp>
297 struct __is_pointer<_Tp*>
299 enum { __value = 1 };
300 typedef __true_type __type;
306 template<
typename _Tp>
307 struct __is_normal_iterator
309 enum { __value = 0 };
310 typedef __false_type __type;
313 template<
typename _Iterator,
typename _Container>
314 struct __is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator,
317 enum { __value = 1 };
318 typedef __true_type __type;
324 template<
typename _Tp>
325 struct __is_arithmetic
326 :
public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
332 template<
typename _Tp>
334 :
public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
340 template<
typename _Tp>
343 enum { __value = 0 };
344 typedef __false_type __type;
348 struct __is_char<char>
350 enum { __value = 1 };
351 typedef __true_type __type;
354 #ifdef _GLIBCXX_USE_WCHAR_T
356 struct __is_char<wchar_t>
358 enum { __value = 1 };
359 typedef __true_type __type;
363 template<
typename _Tp>
366 enum { __value = 0 };
367 typedef __false_type __type;
371 struct __is_byte<char>
373 enum { __value = 1 };
374 typedef __true_type __type;
378 struct __is_byte<signed char>
380 enum { __value = 1 };
381 typedef __true_type __type;
385 struct __is_byte<unsigned char>
387 enum { __value = 1 };
388 typedef __true_type __type;
394 template<
typename _Tp>
395 struct __is_move_iterator
397 enum { __value = 0 };
398 typedef __false_type __type;
401 #if __cplusplus >= 201103L
402 template<
typename _Iterator>
405 template<
typename _Iterator>
408 enum { __value = 1 };
409 typedef __true_type __type;
413 _GLIBCXX_END_NAMESPACE_VERSION
416 #endif //_CPP_TYPE_TRAITS_H