31#ifndef ETL_CHAR_TRAITS_INCLUDED
32#define ETL_CHAR_TRAITS_INCLUDED
89 typedef char8_t char_type;
90 typedef unsigned int int_type;
91 typedef long long off_type;
92 typedef size_t pos_type;
93 typedef char state_type;
99 typedef char16_t char_type;
108 typedef char32_t char_type;
128 static ETL_CONSTEXPR
bool eq(char_type a, char_type
b)
134 static ETL_CONSTEXPR
bool lt(char_type a, char_type
b)
140 static ETL_CONSTEXPR14
size_t length(
const char_type* str)
156 static ETL_CONSTEXPR14
size_t length(
const char_type* str,
size_t max_length)
172 static ETL_CONSTEXPR14
void assign(char_type&
r,
const char_type&
c)
178 static ETL_CONSTEXPR14 char_type* assign(char_type* p,
size_t n, char_type
c)
180 if (p != ETL_NULLPTR)
182 etl::fill_n(p,
n,
c);
189 static ETL_CONSTEXPR14 char_type* move(char_type*
dst,
const char_type*
src,
size_t count)
193 etl::copy_n(
src, count,
dst);
197 etl::copy_n(ETL_OR_STD::reverse_iterator<const char_type*>(
src + count),
199 ETL_OR_STD::reverse_iterator<char_type*>(
dst + count));
206 static ETL_CONSTEXPR14 char_type* copy(char_type*
dst,
const char_type*
src,
size_t count)
208 etl::copy_n(
src, count,
dst);
214 static ETL_CONSTEXPR14
int compare(
const char_type*
s1,
const char_type*
s2,
size_t count)
216 for (
size_t i = 0
UL;
i < count; ++
i)
218 const char_type
c1 = *
s1++;
219 const char_type
c2 = *
s2++;
235 static ETL_CONSTEXPR14
const char_type* find(
const char_type* p,
size_t count,
const char_type&
ch)
237 for (
size_t i = 0
UL;
i < count; ++
i)
251 static ETL_CONSTEXPR char_type to_char_type(int_type
c)
253 return static_cast<char_type
>(
c);
257 static ETL_CONSTEXPR int_type to_int_type(char_type
c)
259 return static_cast<int_type
>(
c);
263 static ETL_CONSTEXPR
bool eq_int_type(int_type
c1, int_type
c2)
269 static ETL_CONSTEXPR int_type eof()
275 static ETL_CONSTEXPR int_type not_eof(int_type e)
277 return (e == eof()) ? eof() - 1 : e;
284 template <
typename T>
293 template <
typename T>
302 template <
typename T>
305 while ((*
t1 != 0) || (*
t2 != 0))
327 template <
typename T>
330 while (((*
t1 != 0) || (*
t2 != 0)) && (
n != 0))
352 template <
typename T>
370 template <
typename T>
375 while ((*
src != 0) && (
n != 0))
bitset_ext
Definition absolute.h:38
ETL_CONSTEXPR14 int strncmp(const T *t1, const T *t2, size_t n)
Alternative strncmp for all character types.
Definition char_traits.h:328
ETL_CONSTEXPR14 size_t strlen(const T *t)
Alternative strlen for all character types.
Definition char_traits.h:285
ETL_CONSTEXPR14 T * strncpy(T *dst, const T *src, size_t n)
Alternative strncpy for all character types.
Definition char_traits.h:371
ETL_CONSTEXPR14 int strcmp(const T *t1, const T *t2)
Alternative strcmp for all character types.
Definition char_traits.h:303
ETL_CONSTEXPR14 T * strcpy(T *dst, const T *src)
Alternative strcpy for all character types.
Definition char_traits.h:353
Definition char_traits.h:48
Character traits for any character type.
Definition char_traits.h:120
pair holds two objects of arbitrary type
Definition utility.h:164