43 lines
2.0 KiB
Markdown
43 lines
2.0 KiB
Markdown
[char.traits.general]
|
||
|
||
# 27 Strings library [[strings]](./#strings)
|
||
|
||
## 27.2 Character traits [[char.traits]](char.traits#general)
|
||
|
||
### 27.2.1 General [char.traits.general]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L32)
|
||
|
||
Subclause [[char.traits]](char.traits "27.2 Character traits") defines requirements on classes representing[*character traits*](#def:character_traits),
|
||
and defines a class templatechar_traits<charT>,
|
||
along with five specializations,char_traits<char>,char_traits<char8_t>,char_traits<char16_t>,char_traits<char32_t>,
|
||
andchar_traits<wchar_t>,
|
||
that meet those requirements[.](#1.sentence-1)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L46)
|
||
|
||
Most classes specified in [[string.classes]](string.classes "27.4 String classes"), [[string.view]](string.view "27.3 String view classes"),
|
||
and [[input.output]](input.output "31 Input/output library") need a set of related types and functions to complete
|
||
the definition of their semantics[.](#2.sentence-1)
|
||
|
||
These types and functions are provided as a
|
||
set of member [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]")*s* and functions in the template
|
||
parameter traits used by each such template[.](#2.sentence-2)
|
||
|
||
Subclause [[char.traits]](char.traits "27.2 Character traits") defines the semantics of these members[.](#2.sentence-3)
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/strings.tex#L54)
|
||
|
||
To specialize those templates to generate a string, string view, or
|
||
iostream class to handle a particular character container type ([[defns.character.container]](defns.character.container "3.10 character container type"))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[.](#3.sentence-1)
|
||
|
||
IfX::char_type is not the same type asC, the program is ill-formed[.](#3.sentence-2)
|