Name
char_traits<char> class — Character traits of char type
Synopsis
template<> struct char_traits<char> { typedef char char_type; typedef int int_type; typedef streamoff off_type; typedef streampos pos_type; typedef mbstate_t state_type; static void assign(char_type& dst, const char_type& src); static char_type* assign(char_type* dst, size_t n, const char_type& c); static bool eq(const char_type& c1, const char_type& c2); static bool lt(const char_type& c1, const char_type& c2); static size_t length(const char_type* str); static int compare(const char_type* s1, const char_type* s2, size_t n); static const char_type* find(const char_type* str, size_t n, const char_type& c); static char_type* copy(char_type* dst, char_type* src, size_t n); static char_type* move(char_type* dst, char_type* src, size_t n); static bool eq_int_type(const int_type& i1, const int_type& i2); static int_type eof( ); static int_type not_eof(const int_type& i); static char_type to_char_type(const int_type& i); static int_type to_int_type(const char_type& c); };
The char_traits<char>
class specializes char_traits
for
narrow characters. The streamoff
type is implementation-defined. The streampos
type is defined as fpos<mbstate_t>
in <iosfwd>
. The character traits are
defined for the type char
and
have the same meaning in all locales. The other types are
self-explanatory. The following are the member functions:
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.