Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
Miscellaneous
complex
exception
functional
iterator
limits
locale
memory
new
numeric
stdexcept
typeinfo
utility
valarray
locale
has_facet
isalnum
isalpha
iscntrl
isdigit
isgraph
islower
isprint
ispunct
isspace
isupper
isxdigit
locale
tolower
toupper
use_facet
standard facets:
codecvt
codecvt_base
codecvt_byname
collate
collate_byname
ctype
ctype_base
ctype_byname
messages
messages_base
messages_byname
moneypunct
moneypunct_byname
money_base
money_get
money_put
numpunct
numpunct_byname
num_get
num_put
time_base
time_get
time_get_byname
time_put
time_put_byname
ctype
ctype::ctype
public member functions:
ctype::is
ctype::narrow
ctype::scan_is
ctype::scan_not
ctype::tolower
ctype::toupper
ctype::widen
public member types:
ctype::char_type
ctype::mask
protected members:
ctype::do_is
ctype::do_narrow
ctype::do_scan_is
ctype::do_scan_not
ctype::do_tolower
ctype::do_toupper
ctype::do_widen
ctype::~ctype


ctype

class template
<locale>
template <class charT> class ctype;

Character type facet

ctype

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.