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;
147 struct __is_integer<bool>
149 enum { __value = 1 };
150 typedef __true_type __type;
154 struct __is_integer<char>
156 enum { __value = 1 };
157 typedef __true_type __type;
161 struct __is_integer<signed char>
163 enum { __value = 1 };
164 typedef __true_type __type;
168 struct __is_integer<unsigned char>
170 enum { __value = 1 };
171 typedef __true_type __type;
174 # ifdef _GLIBCXX_USE_WCHAR_T 176 struct __is_integer<wchar_t>
178 enum { __value = 1 };
179 typedef __true_type __type;
183 #if __cplusplus >= 201103L 185 struct __is_integer<char16_t>
187 enum { __value = 1 };
188 typedef __true_type __type;
192 struct __is_integer<char32_t>
194 enum { __value = 1 };
195 typedef __true_type __type;
200 struct __is_integer<short>
202 enum { __value = 1 };
203 typedef __true_type __type;
207 struct __is_integer<unsigned short>
209 enum { __value = 1 };
210 typedef __true_type __type;
214 struct __is_integer<int>
216 enum { __value = 1 };
217 typedef __true_type __type;
221 struct __is_integer<unsigned int>
223 enum { __value = 1 };
224 typedef __true_type __type;
228 struct __is_integer<long>
230 enum { __value = 1 };
231 typedef __true_type __type;
235 struct __is_integer<unsigned long>
237 enum { __value = 1 };
238 typedef __true_type __type;
242 struct __is_integer<long long>
244 enum { __value = 1 };
245 typedef __true_type __type;
249 struct __is_integer<unsigned long long>
251 enum { __value = 1 };
252 typedef __true_type __type;
255 #define __INT_N(TYPE) \ 257 struct __is_integer<TYPE> \ 259 enum { __value = 1 }; \ 260 typedef __true_type __type; \ 263 struct __is_integer<unsigned TYPE> \ 265 enum { __value = 1 }; \ 266 typedef __true_type __type; \ 269 #ifdef __GLIBCXX_TYPE_INT_N_0 270 __INT_N(__GLIBCXX_TYPE_INT_N_0)
272 #ifdef __GLIBCXX_TYPE_INT_N_1 273 __INT_N(__GLIBCXX_TYPE_INT_N_1)
275 #ifdef __GLIBCXX_TYPE_INT_N_2 276 __INT_N(__GLIBCXX_TYPE_INT_N_2)
278 #ifdef __GLIBCXX_TYPE_INT_N_3 279 __INT_N(__GLIBCXX_TYPE_INT_N_3)
287 template<
typename _Tp>
290 enum { __value = 0 };
291 typedef __false_type __type;
296 struct __is_floating<float>
298 enum { __value = 1 };
299 typedef __true_type __type;
303 struct __is_floating<double>
305 enum { __value = 1 };
306 typedef __true_type __type;
310 struct __is_floating<long double>
312 enum { __value = 1 };
313 typedef __true_type __type;
319 template<
typename _Tp>
322 enum { __value = 0 };
323 typedef __false_type __type;
326 template<
typename _Tp>
327 struct __is_pointer<_Tp*>
329 enum { __value = 1 };
330 typedef __true_type __type;
336 template<
typename _Tp>
337 struct __is_normal_iterator
339 enum { __value = 0 };
340 typedef __false_type __type;
343 template<
typename _Iterator,
typename _Container>
344 struct __is_normal_iterator<
__gnu_cxx::__normal_iterator<_Iterator,
347 enum { __value = 1 };
348 typedef __true_type __type;
354 template<
typename _Tp>
355 struct __is_arithmetic
356 :
public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
362 template<
typename _Tp>
364 :
public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
370 template<
typename _Tp>
373 enum { __value = 0 };
374 typedef __false_type __type;
378 struct __is_char<char>
380 enum { __value = 1 };
381 typedef __true_type __type;
384 #ifdef _GLIBCXX_USE_WCHAR_T 386 struct __is_char<wchar_t>
388 enum { __value = 1 };
389 typedef __true_type __type;
393 template<
typename _Tp>
396 enum { __value = 0 };
397 typedef __false_type __type;
401 struct __is_byte<char>
403 enum { __value = 1 };
404 typedef __true_type __type;
408 struct __is_byte<signed char>
410 enum { __value = 1 };
411 typedef __true_type __type;
415 struct __is_byte<unsigned char>
417 enum { __value = 1 };
418 typedef __true_type __type;
424 template<
typename _Tp>
425 struct __is_move_iterator
427 enum { __value = 0 };
428 typedef __false_type __type;
431 #if __cplusplus >= 201103L 432 template<
typename _Iterator>
435 template<
typename _Iterator>
438 enum { __value = 1 };
439 typedef __true_type __type;
443 _GLIBCXX_END_NAMESPACE_VERSION
446 #endif //_CPP_TYPE_TRAITS_H GNU extensions for public use.
ISO C++ entities toplevel namespace is std.