32 #ifndef _CPP_TYPE_TRAITS_H
33 #define _CPP_TYPE_TRAITS_H 1
35 #pragma GCC system_header
69 namespace std _GLIBCXX_VISIBILITY(default)
71 _GLIBCXX_BEGIN_NAMESPACE_VERSION
73 struct __true_type { };
74 struct __false_type { };
78 {
typedef __false_type __type; };
81 struct __truth_type<true>
82 {
typedef __true_type __type; };
86 template<
class _Sp,
class _Tp>
89 enum { __value = bool(_Sp::__value) || bool(_Tp::__value) };
90 typedef typename __truth_type<__value>::__type __type;
94 template<
typename,
typename>
98 typedef __false_type __type;
101 template<
typename _Tp>
102 struct __are_same<_Tp, _Tp>
104 enum { __value = 1 };
105 typedef __true_type __type;
109 template<
typename _Tp>
112 enum { __value = 0 };
113 typedef __false_type __type;
117 struct __is_void<void>
119 enum { __value = 1 };
120 typedef __true_type __type;
126 template<
typename _Tp>
129 enum { __value = 0 };
130 typedef __false_type __type;
138 struct __is_integer<bool>
140 enum { __value = 1 };
141 typedef __true_type __type;
145 struct __is_integer<char>
147 enum { __value = 1 };
148 typedef __true_type __type;
152 struct __is_integer<signed char>
154 enum { __value = 1 };
155 typedef __true_type __type;
159 struct __is_integer<unsigned char>
161 enum { __value = 1 };
162 typedef __true_type __type;
165 # ifdef __WCHAR_TYPE__
167 struct __is_integer<wchar_t>
169 enum { __value = 1 };
170 typedef __true_type __type;
174 #ifdef _GLIBCXX_USE_CHAR8_T
176 struct __is_integer<char8_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) \
258 struct __is_integer<TYPE> \
260 enum { __value = 1 }; \
261 typedef __true_type __type; \
265 struct __is_integer<unsigned TYPE> \
267 enum { __value = 1 }; \
268 typedef __true_type __type; \
271 #ifdef __GLIBCXX_TYPE_INT_N_0
272 __INT_N(__GLIBCXX_TYPE_INT_N_0)
274 #ifdef __GLIBCXX_TYPE_INT_N_1
275 __INT_N(__GLIBCXX_TYPE_INT_N_1)
277 #ifdef __GLIBCXX_TYPE_INT_N_2
278 __INT_N(__GLIBCXX_TYPE_INT_N_2)
280 #ifdef __GLIBCXX_TYPE_INT_N_3
281 __INT_N(__GLIBCXX_TYPE_INT_N_3)
289 template<
typename _Tp>
292 enum { __value = 0 };
293 typedef __false_type __type;
298 struct __is_floating<float>
300 enum { __value = 1 };
301 typedef __true_type __type;
305 struct __is_floating<double>
307 enum { __value = 1 };
308 typedef __true_type __type;
312 struct __is_floating<long double>
314 enum { __value = 1 };
315 typedef __true_type __type;
321 template<
typename _Tp>
324 enum { __value = 0 };
325 typedef __false_type __type;
328 template<
typename _Tp>
329 struct __is_pointer<_Tp*>
331 enum { __value = 1 };
332 typedef __true_type __type;
338 template<
typename _Tp>
339 struct __is_arithmetic
340 :
public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
346 template<
typename _Tp>
348 :
public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
354 template<
typename _Tp>
357 enum { __value = 0 };
358 typedef __false_type __type;
362 struct __is_char<char>
364 enum { __value = 1 };
365 typedef __true_type __type;
368 #ifdef __WCHAR_TYPE__
370 struct __is_char<wchar_t>
372 enum { __value = 1 };
373 typedef __true_type __type;
377 template<
typename _Tp>
380 enum { __value = 0 };
381 typedef __false_type __type;
385 struct __is_byte<char>
387 enum { __value = 1 };
388 typedef __true_type __type;
392 struct __is_byte<signed char>
394 enum { __value = 1 };
395 typedef __true_type __type;
399 struct __is_byte<unsigned char>
401 enum { __value = 1 };
402 typedef __true_type __type;
405 #if __cplusplus >= 201703L
406 enum class byte : unsigned char;
409 struct __is_byte<byte>
411 enum { __value = 1 };
412 typedef __true_type __type;
416 #ifdef _GLIBCXX_USE_CHAR8_T
418 struct __is_byte<char8_t>
420 enum { __value = 1 };
421 typedef __true_type __type;
425 template<
typename>
struct iterator_traits;
428 template<
typename _Tp>
429 struct __is_nonvolatile_trivially_copyable
431 enum { __value = __is_trivially_copyable(_Tp) };
437 template<
typename _Tp>
438 struct __is_nonvolatile_trivially_copyable<volatile _Tp>
440 enum { __value = 0 };
444 template<
typename _OutputIter,
typename _InputIter>
447 enum { __value = 0 };
450 template<
typename _Tp>
451 struct __memcpyable<_Tp*, _Tp*>
452 : __is_nonvolatile_trivially_copyable<_Tp>
455 template<
typename _Tp>
456 struct __memcpyable<_Tp*,
const _Tp*>
457 : __is_nonvolatile_trivially_copyable<_Tp>
465 template<
typename _Iter1,
typename _Iter2>
468 enum { __value = 0 };
472 template<
typename _Tp>
473 struct __memcmpable<_Tp*, _Tp*>
474 : __is_nonvolatile_trivially_copyable<_Tp>
477 template<
typename _Tp>
478 struct __memcmpable<const _Tp*, _Tp*>
479 : __is_nonvolatile_trivially_copyable<_Tp>
482 template<
typename _Tp>
483 struct __memcmpable<_Tp*,
const _Tp*>
484 : __is_nonvolatile_trivially_copyable<_Tp>
493 template<
typename _Tp,
bool _TreatAsBytes =
494 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
495 __is_integer<_Tp>::__value
497 __is_byte<_Tp>::__value
500 struct __is_memcmp_ordered
502 static const bool __value = _Tp(-1) > _Tp(1);
505 template<
typename _Tp>
506 struct __is_memcmp_ordered<_Tp, false>
508 static const bool __value =
false;
512 template<
typename _Tp,
typename _Up,
bool = sizeof(_Tp) == sizeof(_Up)>
513 struct __is_memcmp_ordered_with
515 static const bool __value = __is_memcmp_ordered<_Tp>::__value
516 && __is_memcmp_ordered<_Up>::__value;
519 template<
typename _Tp,
typename _Up>
520 struct __is_memcmp_ordered_with<_Tp, _Up, false>
522 static const bool __value =
false;
525 #if __cplusplus >= 201703L
526 #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
529 struct __is_memcmp_ordered<
std::
byte, false>
530 {
static constexpr
bool __value =
true; };
536 {
static constexpr
bool __value =
true; };
538 template<
typename _Tp,
bool _SameSize>
539 struct __is_memcmp_ordered_with<_Tp,
std::
byte, _SameSize>
540 {
static constexpr
bool __value =
false; };
542 template<
typename _Up,
bool _SameSize>
543 struct __is_memcmp_ordered_with<
std::
byte, _Up, _SameSize>
544 {
static constexpr
bool __value =
false; };
550 template<
typename _Tp>
551 struct __is_move_iterator
553 enum { __value = 0 };
554 typedef __false_type __type;
559 template<
typename _Iterator>
562 __miter_base(_Iterator __it)
565 _GLIBCXX_END_NAMESPACE_VERSION
ISO C++ entities toplevel namespace is std.