33 #ifndef _CPP_TYPE_TRAITS_H
34 #define _CPP_TYPE_TRAITS_H 1
36 #pragma GCC system_header
69 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
71 _GLIBCXX_BEGIN_NAMESPACE_VERSION
73 template<
typename _Iterator,
typename _Container>
74 class __normal_iterator;
76 _GLIBCXX_END_NAMESPACE_VERSION
79 namespace std _GLIBCXX_VISIBILITY(default)
81 _GLIBCXX_BEGIN_NAMESPACE_VERSION
83 struct __true_type { };
84 struct __false_type { };
88 {
typedef __false_type __type; };
91 struct __truth_type<true>
92 {
typedef __true_type __type; };
96 template<
class _Sp,
class _Tp>
99 enum { __value = bool(_Sp::__value) || bool(_Tp::__value) };
100 typedef typename __truth_type<__value>::__type __type;
104 template<
typename,
typename>
107 enum { __value = 0 };
108 typedef __false_type __type;
111 template<
typename _Tp>
112 struct __are_same<_Tp, _Tp>
114 enum { __value = 1 };
115 typedef __true_type __type;
119 template<
typename _Tp>
122 enum { __value = 0 };
123 typedef __false_type __type;
127 struct __is_void<void>
129 enum { __value = 1 };
130 typedef __true_type __type;
136 template<
typename _Tp>
139 enum { __value = 0 };
140 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 #ifdef __GXX_EXPERIMENTAL_CXX0X__
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;
258 template<
typename _Tp>
261 enum { __value = 0 };
262 typedef __false_type __type;
267 struct __is_floating<float>
269 enum { __value = 1 };
270 typedef __true_type __type;
274 struct __is_floating<double>
276 enum { __value = 1 };
277 typedef __true_type __type;
281 struct __is_floating<long double>
283 enum { __value = 1 };
284 typedef __true_type __type;
290 template<
typename _Tp>
293 enum { __value = 0 };
294 typedef __false_type __type;
297 template<
typename _Tp>
298 struct __is_pointer<_Tp*>
300 enum { __value = 1 };
301 typedef __true_type __type;
307 template<
typename _Tp>
308 struct __is_normal_iterator
310 enum { __value = 0 };
311 typedef __false_type __type;
314 template<
typename _Iterator,
typename _Container>
315 struct __is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator,
318 enum { __value = 1 };
319 typedef __true_type __type;
325 template<
typename _Tp>
326 struct __is_arithmetic
327 :
public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
333 template<
typename _Tp>
334 struct __is_fundamental
335 :
public __traitor<__is_void<_Tp>, __is_arithmetic<_Tp> >
341 template<
typename _Tp>
343 :
public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
349 template<
typename _Tp>
352 enum { __value = 0 };
353 typedef __false_type __type;
357 struct __is_char<char>
359 enum { __value = 1 };
360 typedef __true_type __type;
363 #ifdef _GLIBCXX_USE_WCHAR_T
365 struct __is_char<wchar_t>
367 enum { __value = 1 };
368 typedef __true_type __type;
372 template<
typename _Tp>
375 enum { __value = 0 };
376 typedef __false_type __type;
380 struct __is_byte<char>
382 enum { __value = 1 };
383 typedef __true_type __type;
387 struct __is_byte<signed char>
389 enum { __value = 1 };
390 typedef __true_type __type;
394 struct __is_byte<unsigned char>
396 enum { __value = 1 };
397 typedef __true_type __type;
403 template<
typename _Tp>
404 struct __is_move_iterator
406 enum { __value = 0 };
407 typedef __false_type __type;
410 #ifdef __GXX_EXPERIMENTAL_CXX0X__
411 template<
typename _Iterator>
414 template<
typename _Iterator>
417 enum { __value = 1 };
418 typedef __true_type __type;
422 _GLIBCXX_END_NAMESPACE_VERSION
425 #endif //_CPP_TYPE_TRAITS_H