32 #ifndef _POD_CHAR_TRAITS_H
33 #define _POD_CHAR_TRAITS_H 1
37 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
44 template<typename V, typename I, typename S = std::mbstate_t>
58 char_type ret = {
static_cast<value_type
>(v) };
64 to(
const char_type& c)
66 V2 ret = {
static_cast<V2
>(c.value) };
72 template<
typename V,
typename I,
typename S>
75 {
return lhs.value == rhs.value; }
77 template<
typename V,
typename I,
typename S>
80 {
return lhs.value < rhs.value; }
82 _GLIBCXX_END_NAMESPACE
84 _GLIBCXX_BEGIN_NAMESPACE(std)
87 template<
typename V,
typename I,
typename S>
91 typedef typename char_type::int_type int_type;
92 typedef typename char_type::state_type state_type;
97 assign(char_type& __c1,
const char_type& __c2)
101 eq(
const char_type& __c1,
const char_type& __c2)
102 {
return __c1 == __c2; }
105 lt(
const char_type& __c1,
const char_type& __c2)
106 {
return __c1 < __c2; }
109 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
111 for (
size_t __i = 0; __i < __n; ++__i)
112 if (!eq(__s1[__i], __s2[__i]))
113 return lt(__s1[__i], __s2[__i]) ? -1 : 1;
118 length(
const char_type* __s)
120 const char_type* __p = __s;
126 static const char_type*
127 find(
const char_type* __s,
size_t __n,
const char_type& __a)
129 for (
const char_type* __p = __s; size_t(__p - __s) < __n; ++__p)
136 move(char_type* __s1,
const char_type* __s2,
size_t __n)
138 return static_cast<char_type*
>
139 (__builtin_memmove(__s1, __s2, __n *
sizeof(char_type)));
143 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
145 std::copy(__s2, __s2 + __n, __s1);
150 assign(char_type* __s,
size_t __n, char_type __a)
157 to_char_type(
const int_type& __i)
158 {
return char_type::template from(__i); }
161 to_int_type(
const char_type& __c)
162 {
return char_type::template to<int_type>(__c); }
165 eq_int_type(
const int_type& __c1,
const int_type& __c2)
166 {
return __c1 == __c2; }
171 int_type __r = { -1 };
176 not_eof(
const int_type& __c)
177 {
return eq_int_type(__c, eof()) ? int_type() : __c; }
180 _GLIBCXX_END_NAMESPACE