Standard C++ Library Reference ISO/IEC (VERSION3)
char_traits
template<class Elem>
class char_traits {
public:
typedef Elem char_type;
typedef T1 int_type;
typedef T2 pos_type;
typedef T3 off_type;
typedef T4 state_type;
static void assign(char_type& left, const char_type& right);
static char_type *assign(char_type *first, size_t count,
char_type ch);
static bool eq(const char_type& left,
const char_type& right);
static bool lt(const char_type& left,
const char_type& right);
static int compare(const char_type *first1,
const char_type *first2, size_t count);
static size_t length(const char_type *first);
static char_type *copy(char_type *first1,
const char_type *first2, size_t count);
static char_type *move(char_type *first1,
const char_type *first2, size_t count);
static const char_type *find(const char_type *first,
size_t count, const char_type& ch);
static char_type to_char_type(const int_type& meta);
static int_type to_int_type(const char_type& ch);
static bool eq_int_type(const int_type& left,
const int_type& right);
static int_type eof();
static int_type not_eof(const int_type& meta);
};
The template class describes various character traits for type Elem. The template class
basic_string as well as several iostreams template classes, including basic_ios, use this
information to manipulate elements of type Elem. Such an element type must not require explicit
construction or destruction. It must supply a default constructor, a copy constructor, and an
assignment operator, with the expected semantics. A bitwise copy must have the same effect as an
assignment.
Not all parts of the Standard C++ Library rely completely upon the member functions of
char_traits<Elem> to manipulate an element. Specifically, formatted input functions and