class template
template <class charT> class ctype;

Character type facet


The ctype standard facet is used to classify and convert characters.

ctype objects are prevented to be locally constructed by having a protected destructor. Only those installed in locale objects should be used through mechanisms such as use_facet.

This template class has one template parameter, representing the character type with which the facet works. This template parameter is referred in this entire reference as charT.

Public members

It includes the following public member functions:

Character classification:

Character transformation:

It also declares the following alias type:

And inherits the following type:

Virtual protected members

The class defines the virtual protected members in charge of implementing the expected behavior of their respective public member functions:

Along with the class destructor:

ctype specialization: ctype<char>

The char version is specialized, so that some of their member functions can be implemented inline instead of calling their do_ counterpart (this is the case for members is, scan_is and scan_not).

The constructor for this specialization is different than the one for the general template (see ctype::ctype for more info).

This specialization keeps an internal table array member. This private member is an array of elements of type ctype::mask containing the classification of each of the characters in the character set: The value of each element in the array corresponds to the classification of the character given by its order position. In other words, the table is what member ctype::is would return for an array of char elements whose values are the sequence of values a char element can take, from 0 to its highest value.

The highest value in the table is given by public member constant ctype::table_size (which is, at least, 256).

Also, two additional protected members are provided in this specialization to access the table:
const mask* table () const throw;
Returns the table being used by the object. This is either the first argument used in the constructor, or the classic table if zero was used as first argument for the constructor.
static const mask* classic_table () throw;
Returns the classic table, which is a default table used in case none is provided in the constructor.