32 #ifndef _POD_CHAR_TRAITS_H
33 #define _POD_CHAR_TRAITS_H 1
35 #pragma GCC system_header
41 _GLIBCXX_BEGIN_NAMESPACE_VERSION
48 template<
typename V,
typename I,
typename S = std::mbstate_t>
54 typedef character<V, I, S> char_type;
62 char_type ret = {
static_cast<value_type
>(v) };
68 to(
const char_type& c)
70 V2 ret = {
static_cast<V2
>(c.value) };
76 template<
typename V,
typename I,
typename S>
78 operator==(
const character<V, I, S>& lhs,
const character<V, I, S>& rhs)
79 {
return lhs.value == rhs.value; }
81 template<
typename V,
typename I,
typename S>
83 operator<(const character<V, I, S>& lhs,
const character<V, I, S>& rhs)
84 {
return lhs.value < rhs.value; }
86 _GLIBCXX_END_NAMESPACE_VERSION
89 namespace std _GLIBCXX_VISIBILITY(default)
91 _GLIBCXX_BEGIN_NAMESPACE_VERSION
94 template<
typename V,
typename I,
typename S>
95 struct char_traits<__gnu_cxx::character<V, I, S> >
97 typedef __gnu_cxx::character<V, I, S> char_type;
98 typedef typename char_type::int_type int_type;
99 typedef typename char_type::state_type state_type;
100 typedef fpos<state_type> pos_type;
101 typedef streamoff off_type;
104 assign(char_type& __c1,
const char_type& __c2)
108 eq(
const char_type& __c1,
const char_type& __c2)
109 {
return __c1 == __c2; }
112 lt(
const char_type& __c1,
const char_type& __c2)
113 {
return __c1 < __c2; }
116 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
118 for (
size_t __i = 0; __i < __n; ++__i)
119 if (!eq(__s1[__i], __s2[__i]))
120 return lt(__s1[__i], __s2[__i]) ? -1 : 1;
125 length(
const char_type* __s)
127 const char_type* __p = __s;
133 static const char_type*
134 find(
const char_type* __s,
size_t __n,
const char_type& __a)
136 for (
const char_type* __p = __s;
size_t(__p - __s) < __n; ++__p)
143 move(char_type* __s1,
const char_type* __s2,
size_t __n)
145 return static_cast<char_type*
>
146 (__builtin_memmove(__s1, __s2, __n *
sizeof(char_type)));
150 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
152 std::copy(__s2, __s2 + __n, __s1);
157 assign(char_type* __s,
size_t __n, char_type __a)
159 std::fill_n(__s, __n, __a);
164 to_char_type(
const int_type& __i)
165 {
return char_type::template from(__i); }
168 to_int_type(
const char_type& __c)
169 {
return char_type::template to<int_type>(__c); }
172 eq_int_type(
const int_type& __c1,
const int_type& __c2)
173 {
return __c1 == __c2; }
178 int_type __r = { -1 };
183 not_eof(
const int_type& __c)
184 {
return eq_int_type(__c, eof()) ? int_type() : __c; }
187 _GLIBCXX_END_NAMESPACE_VERSION
bool operator==(const exception_ptr &, const exception_ptr &) _GLIBCXX_USE_NOEXCEPT __attribute__((__pure__))
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
Definition: pod_char_traits.h:39
__SIZE_TYPE__ size_t
Definition: stddef.h:212