21 Strings library [strings]

21.2 Character traits [char.traits]

21.2.1 General [char.traits.general]

Subclause [char.traits] defines requirements on classes representing character traits, and defines a class template char_­traits<charT>, along with five specializations, char_­traits<char>, char_­traits<char8_­t>, char_­traits<char16_­t>, char_­traits<char32_­t>, and char_­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 class X are passed as a pair of parameters to the string, string view, or iostream template as parameters charT and traits.
If X​::​char_­type is not the same type as C, the program is ill-formed.