35#define _CHAR_TRAITS_H 1
38#pragma GCC system_header
47#ifdef _GLIBCXX_USE_WCHAR_T
51#if __cplusplus >= 201103L
53#if !defined __UINT_LEAST16_TYPE__ || !defined __UINT_LEAST32_TYPE__
57#if __cplusplus >= 202002L
62#ifndef _GLIBCXX_ALWAYS_INLINE
63# define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__))
66namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
68_GLIBCXX_BEGIN_NAMESPACE_VERSION
70#pragma GCC diagnostic push
71#pragma GCC diagnostic ignored "-Wstringop-overflow"
72#pragma GCC diagnostic ignored "-Wstringop-overread"
73#pragma GCC diagnostic ignored "-Warray-bounds"
85 template<
typename _CharT>
88 typedef unsigned long int_type;
92 typedef std::mbstate_t state_type;
112 template<
typename _CharT>
115 typedef _CharT char_type;
116 typedef typename _Char_types<_CharT>::int_type int_type;
118 typedef typename _Char_types<_CharT>::pos_type pos_type;
119 typedef typename _Char_types<_CharT>::off_type off_type;
120 typedef typename _Char_types<_CharT>::state_type state_type;
122#if __cpp_lib_three_way_comparison
123 using comparison_category = std::strong_ordering;
126 static _GLIBCXX14_CONSTEXPR
void
127 assign(char_type& __c1,
const char_type& __c2)
129#if __cpp_constexpr_dynamic_alloc
130 if (std::__is_constant_evaluated())
131 std::construct_at(__builtin_addressof(__c1), __c2);
137 static _GLIBCXX_CONSTEXPR
bool
138 eq(
const char_type& __c1,
const char_type& __c2)
139 {
return __c1 == __c2; }
141 static _GLIBCXX_CONSTEXPR
bool
142 lt(
const char_type& __c1,
const char_type& __c2)
143 {
return __c1 < __c2; }
145 static _GLIBCXX14_CONSTEXPR
int
146 compare(
const char_type* __s1,
const char_type* __s2, std::size_t __n);
148 static _GLIBCXX14_CONSTEXPR std::size_t
149 length(
const char_type* __s);
151 static _GLIBCXX14_CONSTEXPR
const char_type*
152 find(
const char_type* __s, std::size_t __n,
const char_type& __a);
154 static _GLIBCXX20_CONSTEXPR char_type*
155 move(char_type* __s1,
const char_type* __s2, std::size_t __n);
157 static _GLIBCXX20_CONSTEXPR char_type*
158 copy(char_type* __s1,
const char_type* __s2, std::size_t __n);
160 static _GLIBCXX20_CONSTEXPR char_type*
161 assign(char_type* __s, std::size_t __n, char_type __a);
163 static _GLIBCXX_CONSTEXPR char_type
164 to_char_type(
const int_type& __c)
165 {
return static_cast<char_type
>(__c); }
167 static _GLIBCXX_CONSTEXPR int_type
168 to_int_type(
const char_type& __c)
169 {
return static_cast<int_type
>(__c); }
171 static _GLIBCXX_CONSTEXPR
bool
172 eq_int_type(
const int_type& __c1,
const int_type& __c2)
173 {
return __c1 == __c2; }
175#ifdef _GLIBCXX_STDIO_EOF
176 static _GLIBCXX_CONSTEXPR int_type
178 {
return static_cast<int_type
>(_GLIBCXX_STDIO_EOF); }
180 static _GLIBCXX_CONSTEXPR int_type
181 not_eof(
const int_type& __c)
182 {
return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); }
186 template<
typename _CharT>
187 _GLIBCXX14_CONSTEXPR
int
189 compare(
const char_type* __s1,
const char_type* __s2, std::size_t __n)
191 for (std::size_t __i = 0; __i < __n; ++__i)
192 if (lt(__s1[__i], __s2[__i]))
194 else if (lt(__s2[__i], __s1[__i]))
199 template<
typename _CharT>
200 _GLIBCXX14_CONSTEXPR std::size_t
201 char_traits<_CharT>::
202 length(
const char_type* __p)
205 while (!eq(__p[__i], char_type()))
210 template<
typename _CharT>
211 _GLIBCXX14_CONSTEXPR
const typename char_traits<_CharT>::char_type*
213 find(
const char_type* __s, std::size_t __n,
const char_type& __a)
215 for (std::size_t __i = 0; __i < __n; ++__i)
216 if (eq(__s[__i], __a))
221 template<
typename _CharT>
223 typename char_traits<_CharT>::char_type*
225 move(char_type* __s1,
const char_type* __s2, std::size_t __n)
229#if __cplusplus >= 202002L
230 if (std::__is_constant_evaluated())
233 if (__builtin_constant_p(__s2 < __s1)
234 && __s1 > __s2 && __s1 < (__s2 + __n))
239 assign(__s1[__n], __s2[__n]);
244 copy(__s1, __s2, __n);
248 __builtin_memmove(__s1, __s2, __n *
sizeof(char_type));
252 template<
typename _CharT>
254 typename char_traits<_CharT>::char_type*
256 copy(char_type* __s1,
const char_type* __s2, std::size_t __n)
260#if __cplusplus >= 202002L
261 if (std::__is_constant_evaluated())
263 for (std::size_t __i = 0; __i < __n; ++__i)
264 std::construct_at(__s1 + __i, __s2[__i]);
268 __builtin_memcpy(__s1, __s2, __n *
sizeof(char_type));
272 template<
typename _CharT>
274 typename char_traits<_CharT>::char_type*
276 assign(char_type* __s, std::size_t __n, char_type __a)
278#if __cplusplus >= 202002L
279 if (std::__is_constant_evaluated())
281 for (std::size_t __i = 0; __i < __n; ++__i)
282 std::construct_at(__s + __i, __a);
287#pragma GCC diagnostic push
288#pragma GCC diagnostic ignored "-Wc++17-extensions"
289 if _GLIBCXX_CONSTEXPR (
sizeof(_CharT) == 1 && __is_trivial(_CharT))
294 __builtin_memcpy(&__c, __builtin_addressof(__a), 1);
295 __builtin_memset(__s, __c, __n);
300 for (std::size_t __i = 0; __i < __n; ++__i)
303#pragma GCC diagnostic pop
307_GLIBCXX_END_NAMESPACE_VERSION
310namespace std _GLIBCXX_VISIBILITY(default)
312_GLIBCXX_BEGIN_NAMESPACE_VERSION
327 template<
typename _CharT>
336 typedef char char_type;
341 typedef mbstate_t state_type;
343#if __cpp_lib_three_way_comparison
344 using comparison_category = strong_ordering;
347 static _GLIBCXX17_CONSTEXPR
void
348 assign(char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
350#if __cpp_constexpr_dynamic_alloc
351 if (std::__is_constant_evaluated())
352 std::construct_at(__builtin_addressof(__c1), __c2);
358 static _GLIBCXX_CONSTEXPR
bool
359 eq(
const char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
360 {
return __c1 == __c2; }
362 static _GLIBCXX_CONSTEXPR
bool
363 lt(
const char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
366 return (
static_cast<unsigned char>(__c1)
367 <
static_cast<unsigned char>(__c2));
370 static _GLIBCXX17_CONSTEXPR
int
371 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
375#if __cplusplus >= 201703L
376 if (std::__is_constant_evaluated())
378 for (
size_t __i = 0; __i < __n; ++__i)
379 if (lt(__s1[__i], __s2[__i]))
381 else if (lt(__s2[__i], __s1[__i]))
386 return __builtin_memcmp(__s1, __s2, __n);
389 static _GLIBCXX17_CONSTEXPR
size_t
390 length(
const char_type* __s)
392#if __cplusplus >= 201703L
393 if (std::__is_constant_evaluated())
394 return __gnu_cxx::char_traits<char_type>::length(__s);
396 return __builtin_strlen(__s);
399 static _GLIBCXX17_CONSTEXPR
const char_type*
400 find(
const char_type* __s,
size_t __n,
const char_type& __a)
404#if __cplusplus >= 201703L
405 if (std::__is_constant_evaluated())
406 return __gnu_cxx::char_traits<char_type>::find(__s, __n, __a);
408 return static_cast<const char_type*
>(__builtin_memchr(__s, __a, __n));
411 static _GLIBCXX20_CONSTEXPR char_type*
412 move(char_type* __s1,
const char_type* __s2,
size_t __n)
416#if __cplusplus >= 202002L
417 if (std::__is_constant_evaluated())
418 return __gnu_cxx::char_traits<char_type>::move(__s1, __s2, __n);
420 return static_cast<char_type*
>(__builtin_memmove(__s1, __s2, __n));
423 static _GLIBCXX20_CONSTEXPR char_type*
424 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
428#if __cplusplus >= 202002L
429 if (std::__is_constant_evaluated())
430 return __gnu_cxx::char_traits<char_type>::copy(__s1, __s2, __n);
432 return static_cast<char_type*
>(__builtin_memcpy(__s1, __s2, __n));
435 static _GLIBCXX20_CONSTEXPR char_type*
436 assign(char_type* __s,
size_t __n, char_type __a)
440#if __cplusplus >= 202002L
441 if (std::__is_constant_evaluated())
442 return __gnu_cxx::char_traits<char_type>::assign(__s, __n, __a);
444 return static_cast<char_type*
>(__builtin_memset(__s, __a, __n));
447 static _GLIBCXX_CONSTEXPR char_type
448 to_char_type(
const int_type& __c) _GLIBCXX_NOEXCEPT
449 {
return static_cast<char_type
>(__c); }
453 static _GLIBCXX_CONSTEXPR int_type
454 to_int_type(
const char_type& __c) _GLIBCXX_NOEXCEPT
455 {
return static_cast<int_type
>(
static_cast<unsigned char>(__c)); }
457 static _GLIBCXX_CONSTEXPR
bool
458 eq_int_type(
const int_type& __c1,
const int_type& __c2) _GLIBCXX_NOEXCEPT
459 {
return __c1 == __c2; }
461#ifdef _GLIBCXX_STDIO_EOF
462 static _GLIBCXX_CONSTEXPR int_type
463 eof() _GLIBCXX_NOEXCEPT
464 {
return static_cast<int_type
>(_GLIBCXX_STDIO_EOF); }
466 static _GLIBCXX_CONSTEXPR int_type
467 not_eof(
const int_type& __c) _GLIBCXX_NOEXCEPT
468 {
return (__c == eof()) ? 0 : __c; }
473#ifdef _GLIBCXX_USE_WCHAR_T
478 typedef wchar_t char_type;
479 typedef wint_t int_type;
483 typedef mbstate_t state_type;
485#if __cpp_lib_three_way_comparison
486 using comparison_category = strong_ordering;
489 static _GLIBCXX17_CONSTEXPR
void
490 assign(char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
492#if __cpp_constexpr_dynamic_alloc
493 if (std::__is_constant_evaluated())
494 std::construct_at(__builtin_addressof(__c1), __c2);
500 static _GLIBCXX_CONSTEXPR
bool
501 eq(
const char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
502 {
return __c1 == __c2; }
504 static _GLIBCXX_CONSTEXPR
bool
505 lt(
const char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
506 {
return __c1 < __c2; }
508 static _GLIBCXX17_CONSTEXPR
int
509 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
513#if __cplusplus >= 201703L
514 if (std::__is_constant_evaluated())
515 return __gnu_cxx::char_traits<char_type>::compare(__s1, __s2, __n);
517 return wmemcmp(__s1, __s2, __n);
520 static _GLIBCXX17_CONSTEXPR
size_t
521 length(
const char_type* __s)
523#if __cplusplus >= 201703L
524 if (std::__is_constant_evaluated())
525 return __gnu_cxx::char_traits<char_type>::length(__s);
530 static _GLIBCXX17_CONSTEXPR
const char_type*
531 find(
const char_type* __s,
size_t __n,
const char_type& __a)
535#if __cplusplus >= 201703L
536 if (std::__is_constant_evaluated())
537 return __gnu_cxx::char_traits<char_type>::find(__s, __n, __a);
539 return wmemchr(__s, __a, __n);
542 static _GLIBCXX20_CONSTEXPR char_type*
543 move(char_type* __s1,
const char_type* __s2,
size_t __n)
547#if __cplusplus >= 202002L
548 if (std::__is_constant_evaluated())
549 return __gnu_cxx::char_traits<char_type>::move(__s1, __s2, __n);
551 return wmemmove(__s1, __s2, __n);
554 static _GLIBCXX20_CONSTEXPR char_type*
555 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
559#if __cplusplus >= 202002L
560 if (std::__is_constant_evaluated())
561 return __gnu_cxx::char_traits<char_type>::copy(__s1, __s2, __n);
563 return wmemcpy(__s1, __s2, __n);
566 static _GLIBCXX20_CONSTEXPR char_type*
567 assign(char_type* __s,
size_t __n, char_type __a)
571#if __cplusplus >= 202002L
572 if (std::__is_constant_evaluated())
573 return __gnu_cxx::char_traits<char_type>::assign(__s, __n, __a);
575 return wmemset(__s, __a, __n);
578 static _GLIBCXX_CONSTEXPR char_type
579 to_char_type(
const int_type& __c) _GLIBCXX_NOEXCEPT
580 {
return char_type(__c); }
582 static _GLIBCXX_CONSTEXPR int_type
583 to_int_type(
const char_type& __c) _GLIBCXX_NOEXCEPT
584 {
return int_type(__c); }
586 static _GLIBCXX_CONSTEXPR
bool
587 eq_int_type(
const int_type& __c1,
const int_type& __c2) _GLIBCXX_NOEXCEPT
588 {
return __c1 == __c2; }
591 static _GLIBCXX_CONSTEXPR int_type
592 eof() _GLIBCXX_NOEXCEPT
593 {
return static_cast<int_type
>(WEOF); }
595 static _GLIBCXX_CONSTEXPR int_type
596 not_eof(
const int_type& __c) _GLIBCXX_NOEXCEPT
597 {
return eq_int_type(__c, eof()) ? 0 : __c; }
606#ifdef _GLIBCXX_USE_CHAR8_T
608 struct char_traits<char8_t>
610 typedef char8_t char_type;
611 typedef unsigned int int_type;
613 typedef u8streampos pos_type;
615 typedef mbstate_t state_type;
617#if __cpp_lib_three_way_comparison
618 using comparison_category = strong_ordering;
621 static _GLIBCXX17_CONSTEXPR
void
622 assign(char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
624#if __cpp_constexpr_dynamic_alloc
625 if (std::__is_constant_evaluated())
626 std::construct_at(__builtin_addressof(__c1), __c2);
632 static _GLIBCXX_CONSTEXPR
bool
633 eq(
const char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
634 {
return __c1 == __c2; }
636 static _GLIBCXX_CONSTEXPR
bool
637 lt(
const char_type& __c1,
const char_type& __c2) _GLIBCXX_NOEXCEPT
638 {
return __c1 < __c2; }
640 static _GLIBCXX17_CONSTEXPR
int
641 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
645#if __cplusplus >= 201703L
646 if (std::__is_constant_evaluated())
647 return __gnu_cxx::char_traits<char_type>::compare(__s1, __s2, __n);
649 return __builtin_memcmp(__s1, __s2, __n);
652 static _GLIBCXX17_CONSTEXPR
size_t
653 length(
const char_type* __s)
655#if __cplusplus >= 201703L
656 if (std::__is_constant_evaluated())
657 return __gnu_cxx::char_traits<char_type>::length(__s);
659 return __builtin_strlen((
const char*)__s);
662 static _GLIBCXX17_CONSTEXPR
const char_type*
663 find(
const char_type* __s,
size_t __n,
const char_type& __a)
667#if __cplusplus >= 201703L
668 if (std::__is_constant_evaluated())
669 return __gnu_cxx::char_traits<char_type>::find(__s, __n, __a);
671 return static_cast<const char_type*
>(__builtin_memchr(__s, __a, __n));
674 static _GLIBCXX20_CONSTEXPR char_type*
675 move(char_type* __s1,
const char_type* __s2,
size_t __n)
679#if __cplusplus >= 202002L
680 if (std::__is_constant_evaluated())
681 return __gnu_cxx::char_traits<char_type>::move(__s1, __s2, __n);
683 return static_cast<char_type*
>(__builtin_memmove(__s1, __s2, __n));
686 static _GLIBCXX20_CONSTEXPR char_type*
687 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
691#if __cplusplus >= 202002L
692 if (std::__is_constant_evaluated())
693 return __gnu_cxx::char_traits<char_type>::copy(__s1, __s2, __n);
695 return static_cast<char_type*
>(__builtin_memcpy(__s1, __s2, __n));
698 static _GLIBCXX20_CONSTEXPR char_type*
699 assign(char_type* __s,
size_t __n, char_type __a)
703#if __cplusplus >= 202002L
704 if (std::__is_constant_evaluated())
705 return __gnu_cxx::char_traits<char_type>::assign(__s, __n, __a);
707 return static_cast<char_type*
>(__builtin_memset(__s, __a, __n));
710 static _GLIBCXX_CONSTEXPR char_type
711 to_char_type(
const int_type& __c) _GLIBCXX_NOEXCEPT
712 {
return char_type(__c); }
714 static _GLIBCXX_CONSTEXPR int_type
715 to_int_type(
const char_type& __c) _GLIBCXX_NOEXCEPT
716 {
return int_type(__c); }
718 static _GLIBCXX_CONSTEXPR
bool
719 eq_int_type(
const int_type& __c1,
const int_type& __c2) _GLIBCXX_NOEXCEPT
720 {
return __c1 == __c2; }
723 static _GLIBCXX_CONSTEXPR int_type
724 eof() _GLIBCXX_NOEXCEPT
725 {
return static_cast<int_type
>(-1); }
727 static _GLIBCXX_CONSTEXPR int_type
728 not_eof(
const int_type& __c) _GLIBCXX_NOEXCEPT
729 {
return eq_int_type(__c, eof()) ? 0 : __c; }
734_GLIBCXX_END_NAMESPACE_VERSION
737#if __cplusplus >= 201103L
739namespace std _GLIBCXX_VISIBILITY(default)
741_GLIBCXX_BEGIN_NAMESPACE_VERSION
746 typedef char16_t char_type;
747#ifdef __UINT_LEAST16_TYPE__
748 typedef __UINT_LEAST16_TYPE__ int_type;
750 typedef uint_least16_t int_type;
755 typedef mbstate_t state_type;
757#if __cpp_lib_three_way_comparison
758 using comparison_category = strong_ordering;
761 static _GLIBCXX17_CONSTEXPR
void
762 assign(char_type& __c1,
const char_type& __c2)
noexcept
764#if __cpp_constexpr_dynamic_alloc
765 if (std::__is_constant_evaluated())
766 std::construct_at(__builtin_addressof(__c1), __c2);
772 static constexpr bool
773 eq(
const char_type& __c1,
const char_type& __c2)
noexcept
774 {
return __c1 == __c2; }
776 static constexpr bool
777 lt(
const char_type& __c1,
const char_type& __c2)
noexcept
778 {
return __c1 < __c2; }
780 static _GLIBCXX17_CONSTEXPR
int
781 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
783 for (
size_t __i = 0; __i < __n; ++__i)
784 if (lt(__s1[__i], __s2[__i]))
786 else if (lt(__s2[__i], __s1[__i]))
791 static _GLIBCXX17_CONSTEXPR
size_t
792 length(
const char_type* __s)
795 while (!eq(__s[__i], char_type()))
800 static _GLIBCXX17_CONSTEXPR
const char_type*
801 find(
const char_type* __s,
size_t __n,
const char_type& __a)
803 for (
size_t __i = 0; __i < __n; ++__i)
804 if (eq(__s[__i], __a))
809 static _GLIBCXX20_CONSTEXPR char_type*
810 move(char_type* __s1,
const char_type* __s2,
size_t __n)
814#if __cplusplus >= 202002L
815 if (std::__is_constant_evaluated())
816 return __gnu_cxx::char_traits<char_type>::move(__s1, __s2, __n);
818 return (
static_cast<char_type*
>
819 (__builtin_memmove(__s1, __s2, __n *
sizeof(char_type))));
822 static _GLIBCXX20_CONSTEXPR char_type*
823 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
827#if __cplusplus >= 202002L
828 if (std::__is_constant_evaluated())
829 return __gnu_cxx::char_traits<char_type>::copy(__s1, __s2, __n);
831 return (
static_cast<char_type*
>
832 (__builtin_memcpy(__s1, __s2, __n *
sizeof(char_type))));
835 static _GLIBCXX20_CONSTEXPR char_type*
836 assign(char_type* __s,
size_t __n, char_type __a)
838 for (
size_t __i = 0; __i < __n; ++__i)
839 assign(__s[__i], __a);
843 static constexpr char_type
844 to_char_type(
const int_type& __c)
noexcept
845 {
return char_type(__c); }
847 static constexpr bool
848 eq_int_type(
const int_type& __c1,
const int_type& __c2)
noexcept
849 {
return __c1 == __c2; }
852 static constexpr int_type
853 to_int_type(
const char_type& __c)
noexcept
854 {
return __c == eof() ? int_type(0xfffd) : int_type(__c); }
856 static constexpr int_type
858 {
return static_cast<int_type
>(-1); }
860 static constexpr int_type
861 not_eof(
const int_type& __c)
noexcept
862 {
return eq_int_type(__c, eof()) ? 0 : __c; }
864 static constexpr int_type
865 to_int_type(
const char_type& __c)
noexcept
866 {
return int_type(__c); }
873 typedef char32_t char_type;
874#ifdef __UINT_LEAST32_TYPE__
875 typedef __UINT_LEAST32_TYPE__ int_type;
877 typedef uint_least32_t int_type;
882 typedef mbstate_t state_type;
884#if __cpp_lib_three_way_comparison
885 using comparison_category = strong_ordering;
888 static _GLIBCXX17_CONSTEXPR
void
889 assign(char_type& __c1,
const char_type& __c2)
noexcept
891#if __cpp_constexpr_dynamic_alloc
892 if (std::__is_constant_evaluated())
893 std::construct_at(__builtin_addressof(__c1), __c2);
899 static constexpr bool
900 eq(
const char_type& __c1,
const char_type& __c2)
noexcept
901 {
return __c1 == __c2; }
903 static constexpr bool
904 lt(
const char_type& __c1,
const char_type& __c2)
noexcept
905 {
return __c1 < __c2; }
907 static _GLIBCXX17_CONSTEXPR
int
908 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
910 for (
size_t __i = 0; __i < __n; ++__i)
911 if (lt(__s1[__i], __s2[__i]))
913 else if (lt(__s2[__i], __s1[__i]))
918 static _GLIBCXX17_CONSTEXPR
size_t
919 length(
const char_type* __s)
922 while (!eq(__s[__i], char_type()))
927 static _GLIBCXX17_CONSTEXPR
const char_type*
928 find(
const char_type* __s,
size_t __n,
const char_type& __a)
930 for (
size_t __i = 0; __i < __n; ++__i)
931 if (eq(__s[__i], __a))
936 static _GLIBCXX20_CONSTEXPR char_type*
937 move(char_type* __s1,
const char_type* __s2,
size_t __n)
941#if __cplusplus >= 202002L
942 if (std::__is_constant_evaluated())
943 return __gnu_cxx::char_traits<char_type>::move(__s1, __s2, __n);
945 return (
static_cast<char_type*
>
946 (__builtin_memmove(__s1, __s2, __n *
sizeof(char_type))));
949 static _GLIBCXX20_CONSTEXPR char_type*
950 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
954#if __cplusplus >= 202002L
955 if (std::__is_constant_evaluated())
956 return __gnu_cxx::char_traits<char_type>::copy(__s1, __s2, __n);
958 return (
static_cast<char_type*
>
959 (__builtin_memcpy(__s1, __s2, __n *
sizeof(char_type))));
962 static _GLIBCXX20_CONSTEXPR char_type*
963 assign(char_type* __s,
size_t __n, char_type __a)
965 for (
size_t __i = 0; __i < __n; ++__i)
966 assign(__s[__i], __a);
970 static constexpr char_type
971 to_char_type(
const int_type& __c)
noexcept
972 {
return char_type(__c); }
974 static constexpr int_type
975 to_int_type(
const char_type& __c)
noexcept
976 {
return int_type(__c); }
978 static constexpr bool
979 eq_int_type(
const int_type& __c1,
const int_type& __c2)
noexcept
980 {
return __c1 == __c2; }
983 static constexpr int_type
985 {
return static_cast<int_type
>(-1); }
987 static constexpr int_type
988 not_eof(
const int_type& __c)
noexcept
989 {
return eq_int_type(__c, eof()) ? 0 : __c; }
993#if __cpp_lib_three_way_comparison
996 template<
typename _ChTraits>
998 __char_traits_cmp_cat(
int __cmp)
noexcept
1000 if constexpr (
requires {
typename _ChTraits::comparison_category; })
1002 using _Cat =
typename _ChTraits::comparison_category;
1003 static_assert( !is_void_v<common_comparison_category_t<_Cat>> );
1004 return static_cast<_Cat
>(__cmp <=> 0);
1007 return static_cast<weak_ordering
>(__cmp <=> 0);
1012#pragma GCC diagnostic pop
1014_GLIBCXX_END_NAMESPACE_VERSION
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 > wstreampos
File position for wchar_t streams.
fpos< mbstate_t > streampos
File position for char streams.
fpos< mbstate_t > u16streampos
File position for char16_t streams.
Implementation details not part of the namespace std interface.
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.