Mapping from character type to associated types.
Base class used to implement std::char_traits.
Basis for explicit traits specializations.
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
57 template<
typename _CharT>
60 typedef unsigned long int_type;
61 typedef std::streampos pos_type;
62 typedef std::streamoff off_type;
63 typedef std::mbstate_t state_type;
82 template<
typename _CharT>
85 typedef _CharT char_type;
86 typedef typename _Char_types<_CharT>::int_type int_type;
87 typedef typename _Char_types<_CharT>::pos_type pos_type;
88 typedef typename _Char_types<_CharT>::off_type off_type;
89 typedef typename _Char_types<_CharT>::state_type state_type;
92 assign(char_type& __c1,
const char_type& __c2)
95 static _GLIBCXX_CONSTEXPR
bool
96 eq(
const char_type& __c1,
const char_type& __c2)
97 {
return __c1 == __c2; }
99 static _GLIBCXX_CONSTEXPR
bool
100 lt(
const char_type& __c1,
const char_type& __c2)
101 {
return __c1 < __c2; }
104 compare(
const char_type* __s1,
const char_type* __s2,
std::size_t __n);
107 length(
const char_type* __s);
109 static const char_type*
110 find(
const char_type* __s,
std::size_t __n,
const char_type& __a);
113 move(char_type* __s1,
const char_type* __s2,
std::size_t __n);
116 copy(char_type* __s1,
const char_type* __s2,
std::size_t __n);
119 assign(char_type* __s,
std::size_t __n, char_type __a);
121 static _GLIBCXX_CONSTEXPR char_type
122 to_char_type(
const int_type& __c)
123 {
return static_cast<char_type
>(__c); }
125 static _GLIBCXX_CONSTEXPR int_type
126 to_int_type(
const char_type& __c)
127 {
return static_cast<int_type
>(__c); }
129 static _GLIBCXX_CONSTEXPR
bool
130 eq_int_type(
const int_type& __c1,
const int_type& __c2)
131 {
return __c1 == __c2; }
133 static _GLIBCXX_CONSTEXPR int_type
135 {
return static_cast<int_type
>(_GLIBCXX_STDIO_EOF); }
137 static _GLIBCXX_CONSTEXPR int_type
138 not_eof(
const int_type& __c)
139 {
return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); }
142 template<
typename _CharT>
144 char_traits<_CharT>::
145 compare(
const char_type* __s1,
const char_type* __s2,
std::size_t __n)
148 if (lt(__s1[__i], __s2[__i]))
150 else if (lt(__s2[__i], __s1[__i]))
155 template<
typename _CharT>
157 char_traits<_CharT>::
158 length(
const char_type* __p)
161 while (!eq(__p[__i], char_type()))
166 template<
typename _CharT>
167 const typename char_traits<_CharT>::char_type*
168 char_traits<_CharT>::
169 find(
const char_type* __s,
std::size_t __n,
const char_type& __a)
172 if (eq(__s[__i], __a))
177 template<
typename _CharT>
178 typename char_traits<_CharT>::char_type*
179 char_traits<_CharT>::
180 move(char_type* __s1,
const char_type* __s2,
std::size_t __n)
182 return static_cast<_CharT*
>(__builtin_memmove(__s1, __s2,
183 __n *
sizeof(char_type)));
186 template<
typename _CharT>
187 typename char_traits<_CharT>::char_type*
188 char_traits<_CharT>::
189 copy(char_type* __s1,
const char_type* __s2,
std::size_t __n)
192 std::copy(__s2, __s2 + __n, __s1);
196 template<
typename _CharT>
197 typename char_traits<_CharT>::char_type*
198 char_traits<_CharT>::
199 assign(char_type* __s,
std::size_t __n, char_type __a)
202 std::fill_n(__s, __n, __a);
206 _GLIBCXX_END_NAMESPACE_VERSION
__SIZE_TYPE__ size_t
Definition: stddef.h:212