2.0 KiB
[char.traits.general]
27 Strings library [strings]
27.2 Character traits [char.traits]
27.2.1 General [char.traits.general]
Subclause [char.traits] defines requirements on classes representingcharacter traits, and defines a class templatechar_traits, along with five specializations,char_traits,char_traits<char8_t>,char_traits<char16_t>,char_traits<char32_t>, andchar_traits<wchar_t>, that meet those requirements.
Most classes specified in [string.classes], [string.view], and [input.output] need a set of related types and functions to complete the definition of their semantics.
These types and functions are provided as a set of member typedef-names and functions in the template parameter traits used by each such template.
Subclause [char.traits] defines the semantics of these members.
To specialize those templates to generate a string, string view, or iostream class to handle a particular character container type ([defns.character.container])C, that and its related character traits classX are passed as a pair of parameters to the string, string view, or iostream template as parameterscharT andtraits.
IfX::char_type is not the same type asC, the program is ill-formed.