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 _GLIBCXX_USE_WCHAR_T
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) \
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_arithmetic
338 :
public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >
344 template<
typename _Tp>
346 :
public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >
352 template<
typename _Tp>
355 enum { __value = 0 };
356 typedef __false_type __type;
360 struct __is_char<char>
362 enum { __value = 1 };
363 typedef __true_type __type;
366 #ifdef _GLIBCXX_USE_WCHAR_T
368 struct __is_char<wchar_t>
370 enum { __value = 1 };
371 typedef __true_type __type;
375 template<
typename _Tp>
378 enum { __value = 0 };
379 typedef __false_type __type;
383 struct __is_byte<char>
385 enum { __value = 1 };
386 typedef __true_type __type;
390 struct __is_byte<signed char>
392 enum { __value = 1 };
393 typedef __true_type __type;
397 struct __is_byte<unsigned char>
399 enum { __value = 1 };
400 typedef __true_type __type;
403 #if __cplusplus >= 201703L
404 enum class byte : unsigned char;
407 struct __is_byte<byte>
409 enum { __value = 1 };
410 typedef __true_type __type;
414 #ifdef _GLIBCXX_USE_CHAR8_T
416 struct __is_byte<char8_t>
418 enum { __value = 1 };
419 typedef __true_type __type;
423 template<
typename>
struct iterator_traits;
426 template<
typename _Tp>
427 struct __is_nonvolatile_trivially_copyable
429 enum { __value = __is_trivially_copyable(_Tp) };
435 template<
typename _Tp>
436 struct __is_nonvolatile_trivially_copyable<volatile _Tp>
438 enum { __value = 0 };
442 template<
typename _OutputIter,
typename _InputIter>
445 enum { __value = 0 };
448 template<
typename _Tp>
449 struct __memcpyable<_Tp*, _Tp*>
450 : __is_nonvolatile_trivially_copyable<_Tp>
453 template<
typename _Tp>
454 struct __memcpyable<_Tp*,
const _Tp*>
455 : __is_nonvolatile_trivially_copyable<_Tp>
463 template<
typename _Iter1,
typename _Iter2>
466 enum { __value = 0 };
470 template<
typename _Tp>
471 struct __memcmpable<_Tp*, _Tp*>
472 : __is_nonvolatile_trivially_copyable<_Tp>
475 template<
typename _Tp>
476 struct __memcmpable<const _Tp*, _Tp*>
477 : __is_nonvolatile_trivially_copyable<_Tp>
480 template<
typename _Tp>
481 struct __memcmpable<_Tp*,
const _Tp*>
482 : __is_nonvolatile_trivially_copyable<_Tp>
488 template<typename _Tp, bool _TreatAsBytes = __is_byte<_Tp>::__value>
489 struct __is_memcmp_ordered
491 static const bool __value = _Tp(-1) > _Tp(1);
494 template<
typename _Tp>
495 struct __is_memcmp_ordered<_Tp, false>
497 static const bool __value =
false;
501 template<
typename _Tp,
typename _Up,
bool = sizeof(_Tp) == sizeof(_Up)>
502 struct __is_memcmp_ordered_with
504 static const bool __value = __is_memcmp_ordered<_Tp>::__value
505 && __is_memcmp_ordered<_Up>::__value;
508 template<
typename _Tp,
typename _Up>
509 struct __is_memcmp_ordered_with<_Tp, _Up, false>
511 static const bool __value =
false;
514 #if __cplusplus >= 201703L
517 struct __is_memcmp_ordered_with<
std::byte, std::byte, true>
518 {
static constexpr
bool __value =
true; };
520 template<
typename _Tp,
bool _SameSize>
521 struct __is_memcmp_ordered_with<_Tp,
std::byte, _SameSize>
522 {
static constexpr
bool __value =
false; };
524 template<
typename _Up,
bool _SameSize>
525 struct __is_memcmp_ordered_with<
std::byte, _Up, _SameSize>
526 {
static constexpr
bool __value =
false; };
532 template<
typename _Tp>
533 struct __is_move_iterator
535 enum { __value = 0 };
536 typedef __false_type __type;
541 template<
typename _Iterator>
544 __miter_base(_Iterator __it)
547 _GLIBCXX_END_NAMESPACE_VERSION
ISO C++ entities toplevel namespace is std.