Name

char_traits<wchar_t> class — Character traits of wchar_t type

Synopsis

template<> struct char_traits<wchar_t> {
  typedef wchar_t char_type;
  typedef wint_t int_type;
  typedef streamoff off_type;
  typedef wstreampos 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<wchar_t> class specializes char_traits for wide characters. The wstreamoff type is implementation-defined. The wstreampos type is defined as fpos<mbstate_t> in <iosfwd>. The other types are self-explanatory. The character traits are defined for the type wchar_t and have the same meaning in all locales.

See char_traits<char> earlier in this section for a description of the member functions. The eof( ) function returns WEOF ...

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.