34 #ifndef _CHAR_TRAITS_H
35 #define _CHAR_TRAITS_H 1
37 #pragma GCC system_header
41 #if __cplusplus >= 202002L
46 #ifndef _GLIBCXX_ALWAYS_INLINE
47 # define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__))
50 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
52 _GLIBCXX_BEGIN_NAMESPACE_VERSION
64 template<
typename _CharT>
67 typedef unsigned long int_type;
70 typedef std::mbstate_t state_type;
89 template<
typename _CharT>
92 typedef _CharT char_type;
93 typedef typename _Char_types<_CharT>::int_type int_type;
95 typedef typename _Char_types<_CharT>::off_type off_type;
96 typedef typename _Char_types<_CharT>::state_type state_type;
97 #if __cpp_lib_three_way_comparison
98 using comparison_category = std::strong_ordering;
101 static _GLIBCXX14_CONSTEXPR
void
102 assign(char_type& __c1,
const char_type& __c2)
104 #if __cpp_constexpr_dynamic_alloc && __cpp_lib_is_constant_evaluated
106 std::construct_at(__builtin_addressof(__c1), __c2);
112 static _GLIBCXX_CONSTEXPR
bool
113 eq(
const char_type& __c1,
const char_type& __c2)
114 {
return __c1 == __c2; }
116 static _GLIBCXX_CONSTEXPR
bool
117 lt(
const char_type& __c1,
const char_type& __c2)
118 {
return __c1 < __c2; }
120 static _GLIBCXX14_CONSTEXPR
int
121 compare(
const char_type* __s1,
const char_type* __s2, std::size_t __n);
123 static _GLIBCXX14_CONSTEXPR std::size_t
124 length(
const char_type* __s);
126 static _GLIBCXX14_CONSTEXPR
const char_type*
127 find(
const char_type* __s, std::size_t __n,
const char_type& __a);
129 static _GLIBCXX20_CONSTEXPR char_type*
130 move(char_type* __s1,
const char_type* __s2, std::size_t __n);
132 static _GLIBCXX20_CONSTEXPR char_type*
133 copy(char_type* __s1,
const char_type* __s2, std::size_t __n);
135 static _GLIBCXX20_CONSTEXPR char_type*
136 assign(char_type* __s, std::size_t __n, char_type __a);
138 static _GLIBCXX_CONSTEXPR char_type
139 to_char_type(
const int_type& __c)
140 {
return static_cast<char_type
>(__c); }
142 static _GLIBCXX_CONSTEXPR int_type
143 to_int_type(
const char_type& __c)
144 {
return static_cast<int_type
>(__c); }
146 static _GLIBCXX_CONSTEXPR
bool
147 eq_int_type(
const int_type& __c1,
const int_type& __c2)
148 {
return __c1 == __c2; }
150 static _GLIBCXX_CONSTEXPR int_type
152 {
return static_cast<int_type
>(_GLIBCXX_STDIO_EOF); }
154 static _GLIBCXX_CONSTEXPR int_type
155 not_eof(
const int_type& __c)
156 {
return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); }
159 template<
typename _CharT>
160 _GLIBCXX14_CONSTEXPR
int
162 compare(
const char_type* __s1,
const char_type* __s2, std::size_t __n)
164 for (std::size_t __i = 0; __i < __n; ++__i)
165 if (lt(__s1[__i], __s2[__i]))
167 else if (lt(__s2[__i], __s1[__i]))
172 template<
typename _CharT>
173 _GLIBCXX14_CONSTEXPR std::size_t
174 char_traits<_CharT>::
175 length(
const char_type* __p)
178 while (!eq(__p[__i], char_type()))
183 template<
typename _CharT>
184 _GLIBCXX14_CONSTEXPR
const typename char_traits<_CharT>::char_type*
185 char_traits<_CharT>::
186 find(
const char_type* __s, std::size_t __n,
const char_type& __a)
188 for (std::size_t __i = 0; __i < __n; ++__i)
189 if (eq(__s[__i], __a))
194 template<
typename _CharT>
196 typename char_traits<_CharT>::char_type*
197 char_traits<_CharT>::
198 move(char_type* __s1,
const char_type* __s2, std::size_t __n)
202 #if __cpp_lib_is_constant_evaluated
207 #if __cpp_constexpr_dynamic_alloc
210 char_type* __tmp =
new char_type[__n];
211 copy(__tmp, __s2, __n);
212 copy(__s1, __tmp, __n);
215 const auto __end = __s2 + __n - 1;
216 bool __overlap =
false;
217 for (std::size_t __i = 0; __i < __n - 1; ++__i)
219 if (__s1 + __i == __end)
230 assign(__s1[__n], __s2[__n]);
235 copy(__s1, __s2, __n);
240 __builtin_memmove(__s1, __s2, __n *
sizeof(char_type));
244 template<
typename _CharT>
246 typename char_traits<_CharT>::char_type*
247 char_traits<_CharT>::
248 copy(char_type* __s1,
const char_type* __s2, std::size_t __n)
250 #if __cpp_lib_is_constant_evaluated
253 for (std::size_t __i = 0; __i < __n; ++__i)
254 std::construct_at(__s1 + __i, __s2[__i]);
259 __builtin_memcpy(__s1, __s2, __n *
sizeof(char_type));
263 template<
typename _CharT>
265 typename char_traits<_CharT>::char_type*
266 char_traits<_CharT>::
267 assign(char_type* __s, std::size_t __n, char_type __a)
269 #if __cpp_lib_is_constant_evaluated
272 for (std::size_t __i = 0; __i < __n; ++__i)
273 std::construct_at(__s + __i, __a);
278 if _GLIBCXX17_CONSTEXPR (
sizeof(_CharT) == 1 && __is_trivial(_CharT))
281 __builtin_memcpy(&__c, __builtin_addressof(__a), 1);
282 __builtin_memset(__s, __c, __n);
286 for (std::size_t __i = 0; __i < __n; ++__i)
292 _GLIBCXX_END_NAMESPACE_VERSION
295 namespace std _GLIBCXX_VISIBILITY(default)
297 _GLIBCXX_BEGIN_NAMESPACE_VERSION
299 #ifdef __cpp_lib_is_constant_evaluated
301 # define __cpp_lib_constexpr_char_traits 201811L
302 #elif __cplusplus >= 201703L && _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
304 # define __cpp_lib_constexpr_char_traits 201611L
320 template<
typename _CharT>
329 typedef char char_type;
330 typedef int int_type;
333 typedef mbstate_t state_type;
334 #if __cpp_lib_three_way_comparison
335 using comparison_category = strong_ordering;
338 static _GLIBCXX17_CONSTEXPR
void
339 assign(char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
341 #if __cpp_constexpr_dynamic_alloc && __cpp_lib_is_constant_evaluated
343 std::construct_at(__builtin_addressof(__c1), __c2);
349 static _GLIBCXX_CONSTEXPR
bool
350 eq(
const char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
351 {
return __c1 == __c2; }
353 static _GLIBCXX_CONSTEXPR
bool
354 lt(
const char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
357 return (
static_cast<unsigned char>(__c1)
358 <
static_cast<unsigned char>(__c2));
361 static _GLIBCXX17_CONSTEXPR
int
362 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
366 #if __cplusplus >= 201703L && _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
367 if (__builtin_is_constant_evaluated())
369 for (
size_t __i = 0; __i < __n; ++__i)
370 if (lt(__s1[__i], __s2[__i]))
372 else if (lt(__s2[__i], __s1[__i]))
377 return __builtin_memcmp(__s1, __s2, __n);
380 static _GLIBCXX17_CONSTEXPR
size_t
381 length(
const char_type* __s)
383 #if __cplusplus >= 201703L && _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
384 if (__builtin_is_constant_evaluated())
387 return __builtin_strlen(__s);
390 static _GLIBCXX17_CONSTEXPR
const char_type*
391 find(
const char_type* __s,
size_t __n,
const char_type& __a)
395 #if __cplusplus >= 201703L && _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
396 if (__builtin_is_constant_evaluated())
399 return static_cast<const char_type*
>(__builtin_memchr(__s, __a, __n));
402 static _GLIBCXX20_CONSTEXPR char_type*
403 move(char_type* __s1,
const char_type* __s2,
size_t __n)
407 #ifdef __cpp_lib_is_constant_evaluated
411 return static_cast<char_type*
>(__builtin_memmove(__s1, __s2, __n));
414 static _GLIBCXX20_CONSTEXPR char_type*
415 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
419 #ifdef __cpp_lib_is_constant_evaluated
423 return static_cast<char_type*
>(__builtin_memcpy(__s1, __s2, __n));
426 static _GLIBCXX20_CONSTEXPR char_type*
427 assign(char_type* __s,
size_t __n, char_type __a)
431 #ifdef __cpp_lib_is_constant_evaluated
435 return static_cast<char_type*
>(__builtin_memset(__s, __a, __n));
438 static _GLIBCXX_CONSTEXPR char_type
439 to_char_type(
const int_type& __c) _GLIBCXX_NOEXCEPT
440 {
return static_cast<char_type
>(__c); }
444 static _GLIBCXX_CONSTEXPR int_type
445 to_int_type(
const char_type& __c) _GLIBCXX_NOEXCEPT
446 {
return static_cast<int_type
>(
static_cast<unsigned char>(__c)); }
448 static _GLIBCXX_CONSTEXPR
bool
449 eq_int_type(
const int_type& __c1,
const int_type& __c2) _GLIBCXX_NOEXCEPT
450 {
return __c1 == __c2; }
452 static _GLIBCXX_CONSTEXPR int_type
453 eof() _GLIBCXX_NOEXCEPT
454 {
return static_cast<int_type
>(_GLIBCXX_STDIO_EOF); }
456 static _GLIBCXX_CONSTEXPR int_type
457 not_eof(
const int_type& __c) _GLIBCXX_NOEXCEPT
458 {
return (__c == eof()) ? 0 : __c; }
462 #ifdef _GLIBCXX_USE_WCHAR_T
467 typedef wchar_t char_type;
468 typedef wint_t int_type;
471 typedef mbstate_t state_type;
472 #if __cpp_lib_three_way_comparison
473 using comparison_category = strong_ordering;
476 static _GLIBCXX17_CONSTEXPR
void
477 assign(char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
479 #if __cpp_constexpr_dynamic_alloc && __cpp_lib_is_constant_evaluated
481 std::construct_at(__builtin_addressof(__c1), __c2);
487 static _GLIBCXX_CONSTEXPR
bool
488 eq(
const char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
489 {
return __c1 == __c2; }
491 static _GLIBCXX_CONSTEXPR
bool
492 lt(
const char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
493 {
return __c1 < __c2; }
495 static _GLIBCXX17_CONSTEXPR
int
496 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
500 #if __cplusplus >= 201703L && _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
501 if (__builtin_is_constant_evaluated())
504 return wmemcmp(__s1, __s2, __n);
507 static _GLIBCXX17_CONSTEXPR
size_t
508 length(
const char_type* __s)
510 #if __cplusplus >= 201703L && _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
511 if (__builtin_is_constant_evaluated())
517 static _GLIBCXX17_CONSTEXPR
const char_type*
518 find(
const char_type* __s,
size_t __n,
const char_type& __a)
522 #if __cplusplus >= 201703L && _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
523 if (__builtin_is_constant_evaluated())
526 return wmemchr(__s, __a, __n);
529 static _GLIBCXX20_CONSTEXPR char_type*
530 move(char_type* __s1,
const char_type* __s2,
size_t __n)
534 #ifdef __cpp_lib_is_constant_evaluated
538 return wmemmove(__s1, __s2, __n);
541 static _GLIBCXX20_CONSTEXPR char_type*
542 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
546 #ifdef __cpp_lib_is_constant_evaluated
550 return wmemcpy(__s1, __s2, __n);
553 static _GLIBCXX20_CONSTEXPR char_type*
554 assign(char_type* __s,
size_t __n, char_type __a)
558 #ifdef __cpp_lib_is_constant_evaluated
562 return wmemset(__s, __a, __n);
565 static _GLIBCXX_CONSTEXPR char_type
566 to_char_type(
const int_type& __c) _GLIBCXX_NOEXCEPT
567 {
return char_type(__c); }
569 static _GLIBCXX_CONSTEXPR int_type
570 to_int_type(
const char_type& __c) _GLIBCXX_NOEXCEPT
571 {
return int_type(__c); }
573 static _GLIBCXX_CONSTEXPR
bool
574 eq_int_type(
const int_type& __c1,
const int_type& __c2) _GLIBCXX_NOEXCEPT
575 {
return __c1 == __c2; }
577 static _GLIBCXX_CONSTEXPR int_type
578 eof() _GLIBCXX_NOEXCEPT
579 {
return static_cast<int_type
>(WEOF); }
581 static _GLIBCXX_CONSTEXPR int_type
582 not_eof(
const int_type& __c) _GLIBCXX_NOEXCEPT
583 {
return eq_int_type(__c, eof()) ? 0 : __c; }
591 #ifdef _GLIBCXX_USE_CHAR8_T
593 struct char_traits<char8_t>
595 typedef char8_t char_type;
596 typedef unsigned int int_type;
597 typedef u8streampos pos_type;
599 typedef mbstate_t state_type;
600 #if __cpp_lib_three_way_comparison
601 using comparison_category = strong_ordering;
604 static _GLIBCXX17_CONSTEXPR
void
605 assign(char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
607 #if __cpp_constexpr_dynamic_alloc && __cpp_lib_is_constant_evaluated
609 std::construct_at(__builtin_addressof(__c1), __c2);
615 static _GLIBCXX_CONSTEXPR
bool
616 eq(
const char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
617 {
return __c1 == __c2; }
619 static _GLIBCXX_CONSTEXPR
bool
620 lt(
const char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
621 {
return __c1 < __c2; }
623 static _GLIBCXX17_CONSTEXPR
int
624 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
628 #if __cplusplus >= 201703L && _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
629 if (__builtin_is_constant_evaluated())
632 return __builtin_memcmp(__s1, __s2, __n);
635 static _GLIBCXX17_CONSTEXPR
size_t
636 length(
const char_type* __s)
638 #if __cplusplus >= 201703L && _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
639 if (__builtin_is_constant_evaluated())
643 while (!eq(__s[__i], char_type()))
648 static _GLIBCXX17_CONSTEXPR
const char_type*
649 find(
const char_type* __s,
size_t __n,
const char_type& __a)
653 #if __cplusplus >= 201703L && _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED
654 if (__builtin_is_constant_evaluated())
657 return static_cast<const char_type*
>(__builtin_memchr(__s, __a, __n));
660 static _GLIBCXX20_CONSTEXPR char_type*
661 move(char_type* __s1,
const char_type* __s2,
size_t __n)
665 #ifdef __cpp_lib_is_constant_evaluated
669 return static_cast<char_type*
>(__builtin_memmove(__s1, __s2, __n));
672 static _GLIBCXX20_CONSTEXPR char_type*
673 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
677 #ifdef __cpp_lib_is_constant_evaluated
681 return static_cast<char_type*
>(__builtin_memcpy(__s1, __s2, __n));
684 static _GLIBCXX20_CONSTEXPR char_type*
685 assign(char_type* __s,
size_t __n, char_type __a)
689 #ifdef __cpp_lib_is_constant_evaluated
693 return static_cast<char_type*
>(__builtin_memset(__s, __a, __n));
696 static _GLIBCXX_CONSTEXPR char_type
697 to_char_type(
const int_type& __c) _GLIBCXX_NOEXCEPT
698 {
return char_type(__c); }
700 static _GLIBCXX_CONSTEXPR int_type
701 to_int_type(
const char_type& __c) _GLIBCXX_NOEXCEPT
702 {
return int_type(__c); }
704 static _GLIBCXX_CONSTEXPR
bool
705 eq_int_type(
const int_type& __c1,
const int_type& __c2) _GLIBCXX_NOEXCEPT
706 {
return __c1 == __c2; }
708 static _GLIBCXX_CONSTEXPR int_type
709 eof() _GLIBCXX_NOEXCEPT
710 {
return static_cast<int_type
>(-1); }
712 static _GLIBCXX_CONSTEXPR int_type
713 not_eof(
const int_type& __c) _GLIBCXX_NOEXCEPT
714 {
return eq_int_type(__c, eof()) ? 0 : __c; }
718 _GLIBCXX_END_NAMESPACE_VERSION
721 #if __cplusplus >= 201103L
725 namespace std _GLIBCXX_VISIBILITY(default)
727 _GLIBCXX_BEGIN_NAMESPACE_VERSION
730 struct char_traits<char16_t>
732 typedef char16_t char_type;
733 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
734 typedef uint_least16_t int_type;
735 #elif defined __UINT_LEAST16_TYPE__
736 typedef __UINT_LEAST16_TYPE__ int_type;
738 typedef make_unsigned<char16_t>::type int_type;
742 typedef mbstate_t state_type;
743 #if __cpp_lib_three_way_comparison
744 using comparison_category = strong_ordering;
747 static _GLIBCXX17_CONSTEXPR
void
748 assign(char_type& __c1,
const char_type& __c2) noexcept
750 #if __cpp_constexpr_dynamic_alloc && __cpp_lib_is_constant_evaluated
752 std::construct_at(__builtin_addressof(__c1), __c2);
758 static constexpr
bool
759 eq(
const char_type& __c1,
const char_type& __c2) noexcept
760 {
return __c1 == __c2; }
762 static constexpr
bool
763 lt(
const char_type& __c1,
const char_type& __c2) noexcept
764 {
return __c1 < __c2; }
766 static _GLIBCXX17_CONSTEXPR
int
767 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
769 for (
size_t __i = 0; __i < __n; ++__i)
770 if (lt(__s1[__i], __s2[__i]))
772 else if (lt(__s2[__i], __s1[__i]))
777 static _GLIBCXX17_CONSTEXPR
size_t
778 length(
const char_type* __s)
781 while (!eq(__s[__i], char_type()))
786 static _GLIBCXX17_CONSTEXPR
const char_type*
787 find(
const char_type* __s,
size_t __n,
const char_type& __a)
789 for (
size_t __i = 0; __i < __n; ++__i)
790 if (eq(__s[__i], __a))
795 static _GLIBCXX20_CONSTEXPR char_type*
796 move(char_type* __s1,
const char_type* __s2,
size_t __n)
800 #ifdef __cpp_lib_is_constant_evaluated
804 return (
static_cast<char_type*
>
805 (__builtin_memmove(__s1, __s2, __n *
sizeof(char_type))));
808 static _GLIBCXX20_CONSTEXPR char_type*
809 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
813 #ifdef __cpp_lib_is_constant_evaluated
817 return (
static_cast<char_type*
>
818 (__builtin_memcpy(__s1, __s2, __n *
sizeof(char_type))));
821 static _GLIBCXX20_CONSTEXPR char_type*
822 assign(char_type* __s,
size_t __n, char_type __a)
824 for (
size_t __i = 0; __i < __n; ++__i)
825 assign(__s[__i], __a);
829 static constexpr char_type
830 to_char_type(
const int_type& __c) noexcept
831 {
return char_type(__c); }
833 static constexpr int_type
834 to_int_type(
const char_type& __c) noexcept
835 {
return __c == eof() ? int_type(0xfffd) : int_type(__c); }
837 static constexpr
bool
838 eq_int_type(
const int_type& __c1,
const int_type& __c2) noexcept
839 {
return __c1 == __c2; }
841 static constexpr int_type
843 {
return static_cast<int_type
>(-1); }
845 static constexpr int_type
846 not_eof(
const int_type& __c) noexcept
847 {
return eq_int_type(__c, eof()) ? 0 : __c; }
851 struct char_traits<char32_t>
853 typedef char32_t char_type;
854 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
855 typedef uint_least32_t int_type;
856 #elif defined __UINT_LEAST32_TYPE__
857 typedef __UINT_LEAST32_TYPE__ int_type;
859 typedef make_unsigned<char32_t>::type int_type;
863 typedef mbstate_t state_type;
864 #if __cpp_lib_three_way_comparison
865 using comparison_category = strong_ordering;
868 static _GLIBCXX17_CONSTEXPR
void
869 assign(char_type& __c1,
const char_type& __c2) noexcept
871 #if __cpp_constexpr_dynamic_alloc && __cpp_lib_is_constant_evaluated
873 std::construct_at(__builtin_addressof(__c1), __c2);
879 static constexpr
bool
880 eq(
const char_type& __c1,
const char_type& __c2) noexcept
881 {
return __c1 == __c2; }
883 static constexpr
bool
884 lt(
const char_type& __c1,
const char_type& __c2) noexcept
885 {
return __c1 < __c2; }
887 static _GLIBCXX17_CONSTEXPR
int
888 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
890 for (
size_t __i = 0; __i < __n; ++__i)
891 if (lt(__s1[__i], __s2[__i]))
893 else if (lt(__s2[__i], __s1[__i]))
898 static _GLIBCXX17_CONSTEXPR
size_t
899 length(
const char_type* __s)
902 while (!eq(__s[__i], char_type()))
907 static _GLIBCXX17_CONSTEXPR
const char_type*
908 find(
const char_type* __s,
size_t __n,
const char_type& __a)
910 for (
size_t __i = 0; __i < __n; ++__i)
911 if (eq(__s[__i], __a))
916 static _GLIBCXX20_CONSTEXPR char_type*
917 move(char_type* __s1,
const char_type* __s2,
size_t __n)
921 #ifdef __cpp_lib_is_constant_evaluated
925 return (
static_cast<char_type*
>
926 (__builtin_memmove(__s1, __s2, __n *
sizeof(char_type))));
929 static _GLIBCXX20_CONSTEXPR char_type*
930 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
934 #ifdef __cpp_lib_is_constant_evaluated
938 return (
static_cast<char_type*
>
939 (__builtin_memcpy(__s1, __s2, __n *
sizeof(char_type))));
942 static _GLIBCXX20_CONSTEXPR char_type*
943 assign(char_type* __s,
size_t __n, char_type __a)
945 for (
size_t __i = 0; __i < __n; ++__i)
946 assign(__s[__i], __a);
950 static constexpr char_type
951 to_char_type(
const int_type& __c) noexcept
952 {
return char_type(__c); }
954 static constexpr int_type
955 to_int_type(
const char_type& __c) noexcept
956 {
return int_type(__c); }
958 static constexpr
bool
959 eq_int_type(
const int_type& __c1,
const int_type& __c2) noexcept
960 {
return __c1 == __c2; }
962 static constexpr int_type
964 {
return static_cast<int_type
>(-1); }
966 static constexpr int_type
967 not_eof(
const int_type& __c) noexcept
968 {
return eq_int_type(__c, eof()) ? 0 : __c; }
971 #if __cpp_lib_three_way_comparison
974 template<
typename _ChTraits>
976 __char_traits_cmp_cat(
int __cmp) noexcept
978 if constexpr (requires {
typename _ChTraits::comparison_category; })
980 using _Cat =
typename _ChTraits::comparison_category;
981 static_assert( !is_void_v<common_comparison_category_t<_Cat>> );
982 return static_cast<_Cat
>(__cmp <=> 0);
985 return static_cast<weak_ordering
>(__cmp <=> 0);
990 _GLIBCXX_END_NAMESPACE_VERSION
constexpr bool is_constant_evaluated() noexcept
Returns true only when called during constant evaluation.
ISO C++ entities toplevel namespace is std.
fpos< mbstate_t > u32streampos
File position for char32_t streams.
long long streamoff
Type used by fpos, char_traits<char>, and char_traits<wchar_t>.
fpos< mbstate_t > u16streampos
File position for char16_t streams.
GNU extensions for public use.
Mapping from character type to associated types.
Base class used to implement std::char_traits.
Basis for explicit traits specializations.
Class representing stream positions.