Files
2025-10-25 03:02:53 +03:00

43 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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.2Character 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.4String classes"), [[string.view]](string.view "27.3String view classes"),
and [[input.output]](input.output "31Input/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.4The 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.2Character 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.10character 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)