This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

View File

@@ -0,0 +1,331 @@
[type.descriptions]
# 16 Library introduction [[library]](./#library)
## 16.3 Method of description [[description]](description#type.descriptions)
### 16.3.3 Other conventions [[conventions]](conventions#type.descriptions)
#### 16.3.3.3 Type descriptions [type.descriptions]
#### [16.3.3.3.1](#general) General [[type.descriptions.general]](type.descriptions.general)
[1](#general-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L579)
The Requirements subclauses may describe names that are used to specify
constraints on template arguments[.](#general-1.sentence-1)[137](#footnote-137 "Examples from [utility.requirements] include: Cpp17EqualityComparable, Cpp17LessThanComparable, Cpp17CopyConstructible. Examples from [iterator.requirements] include: Cpp17InputIterator, Cpp17ForwardIterator.")
These names are used in library Clauses
to describe the types that
may be supplied as arguments by a C++ program when instantiating template components from
the library[.](#general-1.sentence-2)
[2](#general-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L597)
Certain types defined in [[input.output]](input.output "31Input/output library") are used to describe implementation-defined types[.](#general-2.sentence-1)
They are based on other types, but with added constraints[.](#general-2.sentence-2)
[137)](#footnote-137)[137)](#footnoteref-137)
Examples
from [[utility.requirements]](utility.requirements "16.4.4Requirements on types and expressions") include:*Cpp17EqualityComparable*,*Cpp17LessThanComparable*,*Cpp17CopyConstructible*[.](#footnote-137.sentence-1)
Examples from [[iterator.requirements]](iterator.requirements "24.3Iterator requirements") include:*Cpp17InputIterator*,*Cpp17ForwardIterator*[.](#footnote-137.sentence-2)
#### [16.3.3.3.2](#enumerated.types) Enumerated types [[enumerated.types]](enumerated.types)
[1](#enumerated.types-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L604)
Several types defined in [[input.output]](input.output "31Input/output library") are[*enumerated types*](#def:type,enumerated "16.3.3.3.2Enumerated types[enumerated.types]")[.](#enumerated.types-1.sentence-1)
Each enumerated type may be implemented as an enumeration or as a synonym for
an enumeration[.](#enumerated.types-1.sentence-2)[138](#footnote-138 "Such as an integer type, with constant integer values ([basic.fundamental]).")
[2](#enumerated.types-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L614)
The enumerated type *enumerated* can be written:enum *enumerated* { V0, V1, V2, V3, … };
inline const enumerated C0(V0);inline const enumerated C1(V1);inline const enumerated C2(V2);inline const enumerated C3(V3);
[3](#enumerated.types-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L626)
Here, the names C0,C1, etc. represent[*enumerated elements*](#def:enumerated_element "16.3.3.3.2Enumerated types[enumerated.types]") for this particular enumerated type[.](#enumerated.types-3.sentence-1)
All such elements have distinct values[.](#enumerated.types-3.sentence-2)
[138)](#footnote-138)[138)](#footnoteref-138)
Such as an integer type, with constant integer
values ([[basic.fundamental]](basic.fundamental "6.9.2Fundamental types"))[.](#footnote-138.sentence-1)
#### [16.3.3.3.3](#bitmask.types) Bitmask types [[bitmask.types]](bitmask.types)
[1](#bitmask.types-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L636)
Several types defined in [[support]](support "17Language support library") through [[exec]](exec "33Execution control library") and [[depr]](depr "Annex D(normative)Compatibility features") are[*bitmask types*](#def:type,bitmask "16.3.3.3.3Bitmask types[bitmask.types]")[.](#bitmask.types-1.sentence-1)
Each bitmask type can be implemented as an
enumerated type that overloads certain operators, as an integer type,
or as a[bitset](template.bitset "22.9.2Class template bitset[template.bitset]")[.](#bitmask.types-1.sentence-2)
[2](#bitmask.types-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L646)
The bitmask type *bitmask* can be written:// For exposition only.// int_type is an integral type capable of representing all values of the bitmask type.enum *bitmask* : int_type {V0 = 1 << 0, V1 = 1 << 1, V2 = 1 << 2, V3 = 1 << 3, …};
inline constexpr bitmask C0(V0);inline constexpr bitmask C1(V1);inline constexpr bitmask C2(V2);inline constexpr bitmask C3(V3);
constexpr *bitmask* operator&(*bitmask* X, *bitmask* Y) {return static_cast<*bitmask*>(static_cast<int_type>(X) & static_cast<int_type>(Y));}constexpr *bitmask* operator|(*bitmask* X, *bitmask* Y) {return static_cast<*bitmask*>(static_cast<int_type>(X) | static_cast<int_type>(Y));}constexpr *bitmask* operator^(*bitmask* X, *bitmask* Y) {return static_cast<*bitmask*>(static_cast<int_type>(X) ^ static_cast<int_type>(Y));}constexpr *bitmask* operator~(*bitmask* X) {return static_cast<*bitmask*>(~static_cast<int_type>(X));}*bitmask*& operator&=(*bitmask*& X, *bitmask* Y) { X = X & Y; return X;}*bitmask*& operator|=(*bitmask*& X, *bitmask* Y) { X = X | Y; return X;}*bitmask*& operator^=(*bitmask*& X, *bitmask* Y) { X = X ^ Y; return X;}
[3](#bitmask.types-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L687)
Here, the names C0,C1, etc. represent[*bitmask elements*](#def:bitmask,element "16.3.3.3.3Bitmask types[bitmask.types]") for this particular bitmask type[.](#bitmask.types-3.sentence-1)
All such elements have distinct, nonzero values such that, for any pair Ci and Cj where i ≠j, Ci & Ci is nonzero andCi & Cj is zero[.](#bitmask.types-3.sentence-2)
Additionally, the value 0 is used to represent an [*empty bitmask*](#def:bitmask,empty "16.3.3.3.3Bitmask types[bitmask.types]"), in which no
bitmask elements are set[.](#bitmask.types-3.sentence-3)
[4](#bitmask.types-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L699)
The following terms apply to objects and values of
bitmask types:
- [(4.1)](#bitmask.types-4.1)
To [*set*](#def:bitmask,value,set "16.3.3.3.3Bitmask types[bitmask.types]") a value *Y* in an object *X* is to evaluate the expression *X* |= *Y*[.](#bitmask.types-4.1.sentence-1)
- [(4.2)](#bitmask.types-4.2)
To [*clear*](#def:bitmask,value,clear "16.3.3.3.3Bitmask types[bitmask.types]") a value *Y* in an object*X* is to evaluate the expression *X* &= ~*Y*[.](#bitmask.types-4.2.sentence-1)
- [(4.3)](#bitmask.types-4.3)
The value *Y* [*is set*](#def:bitmask,value,is_set "16.3.3.3.3Bitmask types[bitmask.types]") in the object*X* if the expression *X* & *Y* is nonzero[.](#bitmask.types-4.3.sentence-1)
#### [16.3.3.3.4](#character.seq) Character sequences [[character.seq]](character.seq)
#### [16.3.3.3.4.1](#character.seq.general) General [[character.seq.general]](character.seq.general)
[1](#character.seq.general-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L720)
The C standard library makes widespread useof characters and character sequences that follow a few uniform conventions:
- [(1.1)](#character.seq.general-1.1)
Properties specified as [*locale-specific*](#def:locale-specific "16.3.3.3.4.1General[character.seq.general]") may change during program execution
by a call to setlocale(int, const char*) ([[clocale.syn]](clocale.syn "28.3.5.1Header <clocale> synopsis")), or
by a change to a locale object,
as described in [[locales]](locales "28.3.3Locales") and [[input.output]](input.output "31Input/output library")[.](#character.seq.general-1.1.sentence-1)
- [(1.2)](#character.seq.general-1.2)
The [*execution character set*](#def:character_set,execution "16.3.3.3.4.1General[character.seq.general]") and
the [*execution wide-character set*](#def:wide-character_set,execution "16.3.3.3.4.1General[character.seq.general]") are supersets of the basic literal character set ([[lex.charset]](lex.charset "5.3.1Character sets"))[.](#character.seq.general-1.2.sentence-1)
The encodings of the execution character sets and
the sets of additional elements (if any) are locale-specific[.](#character.seq.general-1.2.sentence-2)
Each element of the execution wide-character set is encoded as
a single code unit representable by a value of type wchar_t[.](#character.seq.general-1.2.sentence-3)
[*Note [1](#character.seq.general-note-1)*:
The encodings of the execution character sets can be unrelated
to any literal encoding[.](#character.seq.general-1.2.sentence-4)
— *end note*]
- [(1.3)](#character.seq.general-1.3)
A [*letter*](#def:letter "16.3.3.3.4.1General[character.seq.general]") is any of the 26 lowercase or 26uppercase letters in the basic character set[.](#character.seq.general-1.3.sentence-1)
- [(1.4)](#character.seq.general-1.4)
The[*decimal-point character*](#def:character,decimal-point "16.3.3.3.4.1General[character.seq.general]") is the locale-specific
(single-byte) character used by functions that convert between a (single-byte)
character sequence and a value of one of the floating-point types[.](#character.seq.general-1.4.sentence-1)
It is used
in the character sequence to denote the beginning of a fractional part[.](#character.seq.general-1.4.sentence-2)
It is
represented in [[support]](support "17Language support library") through [[exec]](exec "33Execution control library") and [[depr]](depr "Annex D(normative)Compatibility features") by a period,'.',
which is
also its value in the "C" locale[.](#character.seq.general-1.4.sentence-3)
- [(1.5)](#character.seq.general-1.5)
A[*character sequence*](#def:character_sequence "16.3.3.3.4.1General[character.seq.general]") is an [array object](dcl.array "9.3.4.5Arrays[dcl.array]") *A* that
can be declared as*T A*[*N*],
where *T* is any of the typeschar,unsigned char,
orsigned char ([[basic.fundamental]](basic.fundamental "6.9.2Fundamental types")), optionally qualified by any combination ofconst orvolatile[.](#character.seq.general-1.5.sentence-1)
The initial elements of the
array have defined contents up to and including an element determined by some
predicate[.](#character.seq.general-1.5.sentence-2)
A character sequence can be designated by a pointer value*S* that points to its first element[.](#character.seq.general-1.5.sentence-3)
#### [16.3.3.3.4.2](#byte.strings) Byte strings [[byte.strings]](byte.strings)
[1](#byte.strings-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L788)
A [*null-terminated byte string*](#def:ntbs "16.3.3.3.4.2Byte strings[byte.strings]"),
or ntbs,
is a character sequence whose highest-addressed element
with defined content has the value zero
(the [*terminating null character*](#def:character,terminating_null "16.3.3.3.4.2Byte strings[byte.strings]"));
no other element in the sequence has the value zero[.](#byte.strings-1.sentence-1)[139](#footnote-139 "Many of the objects manipulated by function signatures declared in <cstring> are character sequences or ntbss. The size of some of these character sequences is limited by a length value, maintained separately from the character sequence.")
[2](#byte.strings-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L803)
The [*length of an ntbs*](#def:ntbs,length "16.3.3.3.4.2Byte strings[byte.strings]") is the number of elements that
precede the terminating null character[.](#byte.strings-2.sentence-1)
An [*empty ntbs*](#def:ntbs,empty "16.3.3.3.4.2Byte strings[byte.strings]") has a length of zero[.](#byte.strings-2.sentence-2)
[3](#byte.strings-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L810)
The [*value of an ntbs*](#def:ntbs,value "16.3.3.3.4.2Byte strings[byte.strings]") is the sequence of values of the
elements up to and including the terminating null character[.](#byte.strings-3.sentence-1)
[4](#byte.strings-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L815)
A [*static ntbs*](#def:ntbs,static "16.3.3.3.4.2Byte strings[byte.strings]") is an ntbs with
static storage duration[.](#byte.strings-4.sentence-1)[140](#footnote-140 "A string-literal, such as &quot;abc&quot;, is a static ntbs.")
[139)](#footnote-139)[139)](#footnoteref-139)
Many of the objects manipulated by
function signatures declared in[<cstring>](cstring.syn#header:%3ccstring%3e "27.5.1Header <cstring> synopsis[cstring.syn]") are character sequences or ntbss[.](#footnote-139.sentence-1)
The size of some of these character sequences is limited by
a length value, maintained separately from the character sequence[.](#footnote-139.sentence-2)
[140)](#footnote-140)[140)](#footnoteref-140)
A [*string-literal*](lex.string#nt:string-literal "5.13.5String literals[lex.string]"), such as"abc",
is a static ntbs[.](#footnote-140.sentence-1)
#### [16.3.3.3.4.3](#multibyte.strings) Multibyte strings [[multibyte.strings]](multibyte.strings)
[1](#multibyte.strings-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L827)
A [*multibyte character*](#def:character,multibyte "16.3.3.3.4.3Multibyte strings[multibyte.strings]") is
a sequence of one or more bytes representing the
code unit sequence for an encoded character of the
execution character set[.](#multibyte.strings-1.sentence-1)
[2](#multibyte.strings-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L834)
A [*null-terminated multibyte string*](#def:ntmbs "16.3.3.3.4.3Multibyte strings[multibyte.strings]"),
or ntmbs,
is an ntbs that constitutes a
sequence of valid multibyte characters, beginning and ending in the initial
shift state[.](#multibyte.strings-2.sentence-1)[141](#footnote-141 "An ntbs that contains characters only from the basic literal character set is also an ntmbs. Each multibyte character then consists of a single byte.")
[3](#multibyte.strings-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L847)
A [*static ntmbs*](#def:ntmbs,static "16.3.3.3.4.3Multibyte strings[multibyte.strings]") is an ntmbs with static storage duration[.](#multibyte.strings-3.sentence-1)
[141)](#footnote-141)[141)](#footnoteref-141)
An ntbs that contains characters only from the
basic literal character set is also an ntmbs[.](#footnote-141.sentence-1)
Each multibyte character then
consists of a single byte[.](#footnote-141.sentence-2)
#### [16.3.3.3.5](#customization.point.object) Customization Point Object types [[customization.point.object]](customization.point.object)
[1](#customization.point.object-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L853)
A [*customization point object*](#def:customization_point_object) is a function object ([[function.objects]](function.objects "22.10Function objects"))
with a literal class type that interacts with program-defined types while
enforcing semantic requirements on that interaction[.](#customization.point.object-1.sentence-1)
[2](#customization.point.object-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L858)
The type of a customization point object, ignoring cv-qualifiers, shall model[semiregular](concepts.object#concept:semiregular "18.6Object concepts[concepts.object]") ([[concepts.object]](concepts.object "18.6Object concepts"))[.](#customization.point.object-2.sentence-1)
[3](#customization.point.object-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L862)
All instances of a specific customization point object type shall
be equal ([[concepts.equality]](concepts.equality "18.2Equality preservation"))[.](#customization.point.object-3.sentence-1)
The effects of invoking different instances
of a specific customization point object type on the same arguments
are equivalent[.](#customization.point.object-3.sentence-2)
[4](#customization.point.object-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L869)
The type T of a customization point object,
ignoring [*cv-qualifier*](dcl.decl.general#nt:cv-qualifier "9.3.1General[dcl.decl.general]")*s*, shall model[invocable](concept.invocable#concept:invocable "18.7.2Concept invocable[concept.invocable]")<T&, Args...>,[invocable](concept.invocable#concept:invocable "18.7.2Concept invocable[concept.invocable]")<const T&, Args...>,[invocable](concept.invocable#concept:invocable "18.7.2Concept invocable[concept.invocable]")<T, Args...>, and[invocable](concept.invocable#concept:invocable "18.7.2Concept invocable[concept.invocable]")<const T, Args...> ([[concept.invocable]](concept.invocable "18.7.2Concept invocable"))
when the types in Args... meet the requirements specified in that
customization point object's definition[.](#customization.point.object-4.sentence-1)
When the types of Args... do
not meet the customization point object's requirements, T shall not have
a function call operator that participates in overload resolution[.](#customization.point.object-4.sentence-2)
[5](#customization.point.object-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L881)
For a given customization point object o,
let p be a variable initialized as if by auto p = o;[.](#customization.point.object-5.sentence-1)
Then for any sequence of arguments args...,
the following expressions have effects equivalent to o(args...):
- [(5.1)](#customization.point.object-5.1)
p(args...)
- [(5.2)](#customization.point.object-5.2)
as_const(p)(args...)
- [(5.3)](#customization.point.object-5.3)
std::move(p)(args...)
- [(5.4)](#customization.point.object-5.4)
std::move(as_const(p))(args...)

View File

@@ -0,0 +1,38 @@
[type.descriptions.general]
# 16 Library introduction [[library]](./#library)
## 16.3 Method of description [[description]](description#type.descriptions.general)
### 16.3.3 Other conventions [[conventions]](conventions#type.descriptions.general)
#### 16.3.3.3 Type descriptions [[type.descriptions]](type.descriptions#general)
#### 16.3.3.3.1 General [type.descriptions.general]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L579)
The Requirements subclauses may describe names that are used to specify
constraints on template arguments[.](#1.sentence-1)[137](#footnote-137 "Examples from [utility.requirements] include: Cpp17EqualityComparable, Cpp17LessThanComparable, Cpp17CopyConstructible. Examples from [iterator.requirements] include: Cpp17InputIterator, Cpp17ForwardIterator.")
These names are used in library Clauses
to describe the types that
may be supplied as arguments by a C++ program when instantiating template components from
the library[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L597)
Certain types defined in [[input.output]](input.output "31Input/output library") are used to describe implementation-defined types[.](#2.sentence-1)
They are based on other types, but with added constraints[.](#2.sentence-2)
[137)](#footnote-137)[137)](#footnoteref-137)
Examples
from [[utility.requirements]](utility.requirements "16.4.4Requirements on types and expressions") include:*Cpp17EqualityComparable*,*Cpp17LessThanComparable*,*Cpp17CopyConstructible*[.](#footnote-137.sentence-1)
Examples from [[iterator.requirements]](iterator.requirements "24.3Iterator requirements") include:*Cpp17InputIterator*,*Cpp17ForwardIterator*[.](#footnote-137.sentence-2)

131
cppdraft/type/index.md Normal file
View File

@@ -0,0 +1,131 @@
[type.index]
# 17 Language support library [[support]](./#support)
## 17.7 Type identification [[support.rtti]](support.rtti#type.index)
### 17.7.7 Class type_index [type.index]
[🔗](#lib:type_index)
namespace std {class type_index {public: type_index(const type_info& rhs) noexcept; bool operator==(const type_index& rhs) const noexcept; bool operator< (const type_index& rhs) const noexcept; bool operator> (const type_index& rhs) const noexcept; bool operator<=(const type_index& rhs) const noexcept; bool operator>=(const type_index& rhs) const noexcept;
strong_ordering operator<=>(const type_index& rhs) const noexcept;
size_t hash_code() const noexcept; const char* name() const noexcept; private:const type_info* target; // *exposition only*// Note that the use of a pointer here, rather than a reference,// means that the default copy/move constructor and assignment// operators will be provided and work as expected.};}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3494)
The class type_index provides a simple wrapper fortype_info which can be used as an index type in associative
containers ([[associative]](associative "23.4Associative containers")) and in unordered associative
containers ([[unord]](unord "23.5Unordered associative containers"))[.](#1.sentence-1)
[🔗](#lib:type_index,constructor)
`type_index(const type_info& rhs) noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3506)
*Effects*: Constructs a type_index object, the equivalent of target = &rhs[.](#2.sentence-1)
[🔗](#lib:operator==,type_index)
`bool operator==(const type_index& rhs) const noexcept;
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3517)
*Returns*: *target == *rhs.target[.](#3.sentence-1)
[🔗](#lib:operator%3c,type_index)
`bool operator<(const type_index& rhs) const noexcept;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3528)
*Returns*: target->before(*rhs.target)[.](#4.sentence-1)
[🔗](#lib:operator%3e,type_index)
`bool operator>(const type_index& rhs) const noexcept;
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3539)
*Returns*: rhs.target->before(*target)[.](#5.sentence-1)
[🔗](#lib:operator%3c=,type_index)
`bool operator<=(const type_index& rhs) const noexcept;
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3550)
*Returns*: !rhs.target->before(*target)[.](#6.sentence-1)
[🔗](#lib:operator%3e=,type_index)
`bool operator>=(const type_index& rhs) const noexcept;
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3561)
*Returns*: !target->before(*rhs.target)[.](#7.sentence-1)
[🔗](#lib:operator%3c=%3e,type_index)
`strong_ordering operator<=>(const type_index& rhs) const noexcept;
`
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3572)
*Effects*: Equivalent to:if (*target == *rhs.target) return strong_ordering::equal;if (target->before(*rhs.target)) return strong_ordering::less;return strong_ordering::greater;
[🔗](#lib:hash_code,type_index)
`size_t hash_code() const noexcept;
`
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3588)
*Returns*: target->hash_code()[.](#9.sentence-1)
[🔗](#lib:name,type_index)
`const char* name() const noexcept;
`
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3599)
*Returns*: target->name()[.](#10.sentence-1)
[🔗](#lib:hash,type_index)
`template<> struct hash<type_index>;
`
[11](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3610)
For an object index of type type_index,hash<type_index>()(index) shall evaluate to the same result as index.hash_code()[.](#11.sentence-1)

View File

@@ -0,0 +1,11 @@
[type.index.synopsis]
# 17 Language support library [[support]](./#support)
## 17.7 Type identification [[support.rtti]](support.rtti#type.index.synopsis)
### 17.7.6 Header <typeindex> synopsis [type.index.synopsis]
[🔗](#header:%3ctypeindex%3e)
#include <compare> // see [[compare.syn]](compare.syn "17.12.1Header <compare> synopsis")namespace std {class type_index; template<class T> struct hash; template<> struct hash<type_index>;}

96
cppdraft/type/info.md Normal file
View File

@@ -0,0 +1,96 @@
[type.info]
# 17 Language support library [[support]](./#support)
## 17.7 Type identification [[support.rtti]](support.rtti#type.info)
### 17.7.3 Class type_info [type.info]
[🔗](#lib:type_info)
namespace std {class type_info {public:virtual ~type_info(); constexpr bool operator==(const type_info& rhs) const noexcept; bool before(const type_info& rhs) const noexcept;
size_t hash_code() const noexcept; const char* name() const noexcept;
type_info(const type_info&) = delete;
type_info& operator=(const type_info&) = delete; };}
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3306)
The classtype_info describes type information generated by the implementation ([[expr.typeid]](expr.typeid "7.6.1.8Type identification"))[.](#1.sentence-1)
Objects of this class effectively store a pointer to a name for the type, and
an encoded value suitable for comparing two types for equality or collating order[.](#1.sentence-2)
The names, encoding rule, and collating sequence for types are all unspecifiedand may differ between programs[.](#1.sentence-3)
[🔗](#lib:operator==,type_info)
`constexpr bool operator==(const type_info& rhs) const noexcept;
`
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3322)
*Effects*: Compares the current object with rhs[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3326)
*Returns*: true if the two values describe the same type[.](#3.sentence-1)
[🔗](#lib:before,type_info)
`bool before(const type_info& rhs) const noexcept;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3338)
*Effects*: Compares the current object with rhs[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3342)
*Returns*: true if*this precedes rhs in the implementation's collation order[.](#5.sentence-1)
[🔗](#lib:hash_code,type_info)
`size_t hash_code() const noexcept;
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3356)
*Returns*: An unspecified value, except that within a single execution of the
program, it shall return the same value for any two type_info objects which compare equal[.](#6.sentence-1)
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3362)
*Remarks*: An implementation should return different values for twotype_info objects which do not compare equal[.](#7.sentence-1)
[🔗](#lib:name,type_info)
`const char* name() const noexcept;
`
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3375)
*Returns*: An implementation-defined ntbs[.](#8.sentence-1)
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3379)
*Remarks*: The message may be a[null-terminated multibyte string](multibyte.strings#def:ntmbs "16.3.3.3.4.3Multibyte strings[multibyte.strings]"),
suitable for conversion and display as awstring ([[string.classes]](string.classes "27.4String classes"), [[locale.codecvt]](locale.codecvt "28.3.4.2.5Class template codecvt"))[.](#9.sentence-1)

1260
cppdraft/type/traits.md Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,36 @@
[type.traits.general]
# 21 Metaprogramming library [[meta]](./#meta)
## 21.3 Metaprogramming and type traits [[type.traits]](type.traits#general)
### 21.3.1 General [type.traits.general]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/meta.tex#L76)
Subclause [[type.traits]](type.traits "21.3Metaprogramming and type traits") describes components used by C++ programs, particularly in
templates, to support the widest possible range of types, optimize
template code usage, detect type related user errors, and perform
type inference and transformation at compile time[.](#1.sentence-1)
It includes type
classification traits, type property inspection traits, and type
transformations[.](#1.sentence-2)
The type classification traits describe a complete taxonomy
of all possible C++ types, and state where in that taxonomy a given
type belongs[.](#1.sentence-3)
The type property inspection traits allow important
characteristics of types or of combinations of types to be inspected[.](#1.sentence-4)
The
type transformations allow certain properties of types to be manipulated[.](#1.sentence-5)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/meta.tex#L88)
All functions specified in [[type.traits]](type.traits "21.3Metaprogramming and type traits") are signal-safe ([[support.signal]](support.signal "17.14.5Signal handlers"))[.](#2.sentence-1)