Compartilhar via


ctype Class

A class that provides a facet that is used to classify characters, convert from upper and lower cases, and convert between the native character set and that set used by the locale.

For a list of all members of this type, see ctype Members.

template <class CharType> 
class ctype : public ctype_base

Parameters

  • CharType
    The type used within a program to encode characters.

Remarks

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. Classification criteria are provided a nested bitmask type in the base class ctype_base.

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.

Other specializations of template class ctype<CharType>:

  • Convert a value ch of type CharType to a value of type char with the expression (char)ch.

  • Convert a value byte of type char to a value of type CharType with the expression CharType (byte).

All other operations are performed on char values in the same way as for the explicit specialization ctype<char>.

Requirements

Header: <locale>

Namespace: std

See Also

Reference

Thread Safety in the Standard C++ Library

Other Resources

ctype Members

<locale> Members