std::ctype<char> (3) - Linux Manuals
std::ctype<char>: std::ctype<char>
NAME
std::ctype<char> - std::ctype<char>
Synopsis
Defined in header <locale>
template<>
class ctype<char>;
This specialization of std::ctype encapsulates character classification features for type char. Unlike general-purpose std::ctype, which uses virtual functions, this specialization uses table lookup to classify characters (which is generally faster).
The base class std::ctype<char> implements character classification equivalent to the minimal "C" locale. The classification rules can be extended or modified if constructed with a non-default classification table argument, if constructed as std::ctype_byname<char> or as a user-defined derived facet. All std::istream formatted input functions are required to use std::ctype<char> for character classing during input parsing.
std-ctype char-inheritance.svg
Inheritance diagram
Member types
Member type Definition
char_type char
Member functions
constructor (public member function)
destructor (protected member function)
table (public member function)
classic_table obtains the "C" locale character classification table
[static]
is (public member function)
scan_is (public member function)
scan_not (public member function)
toupper (public member function of std::ctype<CharT>)
tolower (public member function of std::ctype<CharT>)
widen (public member function of std::ctype<CharT>)
narrow (public member function of std::ctype<CharT>)
Protected member functions
do_toupper converts a character or characters to uppercase
[virtual]
do_tolower converts a character or characters to lowercase
[virtual]
do_widen converts a character or characters from char to charT
[virtual]
do_narrow converts a character or characters from charT to char
[virtual]
Member objects
static std::locale::id id id of the locale
[static]
static const std::size_t table_size size of the classification table, at least 256
[static]
Inherited from std::ctype_base
Member types
Type Definition
mask unspecified bitmask type (enumeration, integer type, or bitset)
Member constants
space the value of mask identifying whitespace character classification
[static]
print the value of mask identifying printable character classification
[static]
cntrl the value of mask identifying control character classification
[static]
upper the value of mask identifying uppercase character classification
[static]
lower the value of mask identifying lowercase character classification
[static]
alpha the value of mask identifying alphabetic character classification
[static]
digit the value of mask identifying digit character classification
[static]
punct the value of mask identifying punctuation character classification
[static]
xdigit the value of mask identifying hexadecimal digit character classification
[static]
blank the value of mask identifying blank character classification
[static] (C++11)
alnum alpha | digit
[static]
graph alnum | punct
[static]
Example
The following example demonstrates modification of ctype<char> to tokenize comma-separated values
// Run this code
Output:
See also
ctype (class template)
ctype_base (class template)
ctype_byname (class template)