Standard C++ Library Reference ISO/IEC (VERSION3)

The template class describes an object that can serve as a locale facet, to characterize various properties of a ``character''
(element) of type Elem. Such a facet also converts between sequences of Elem elements and sequences of char.
As with any locale facet, the static object id has an initial stored value of zero. The first attempt to access its stored
value stores a unique positive value in id.
The Standard C++ library defines two explicit specializations of this template class:
ctype<char>, an explicit specialization whose differences are described separately
ctype<wchar_t>, which treats elements as wide characters
In this implementation, other specializations of template class ctype<Elem>:
convert a value ch of type Elem to a value of type char with the expression (char)ch
convert a value byte of type char to a value of type Elem with the expression Elem(byte)
All other operations are performed on char values the same as for the explicit specialization ctype<char>.
ctype::char_type
typedef Elem char_type;
The type is a synonym for the template parameter Elem.
ctype::ctype
explicit ctype(size_t refs = 0);
The constructor initializes its locale::facet base object with locale::facet(refs).
ctype::do_is
virtual bool do_is(mask maskval, Elem ch) const;
virtual const Elem *do_is(const Elem *first, const Elem *last,
mask *dest) const;
The first protected member template function returns true if MASK(ch) & maskval is nonzero, where MASK(ch)
designates the mapping between an element value ch and its classification mask, of type mask. The name MASK is
purely symbolic here; it is not defined by the template class. For an object of class ctype<char>, the mapping is
tab[(unsigned char)(char)ch], where tab is the stored pointer to the ctype mask table.
The second protected member template function stores in dest[I] the value MASK(first[I]) & maskval,
where I ranges over the interval [0, last - first).
ctype::do_narrow
virtual char do_narrow(Elem ch, char dflt) const;
virtual const Elem *do_narrow(const Elem *first, const Elem *last,
char dflt, char *dest) const;
The first protected member template function returns (char)ch, or dflt if that expression is undefined.
The second protected member template function stores in dest[I] the value do_narrow(first[I], dflt), for
I in the interval [0, last - first).
ctype::do_scan_is
virtual const Elem *do_scan_is(mask maskval, const Elem *first,
const Elem *last) const;