Init
This commit is contained in:
610
cppdraft/conventions.md
Normal file
610
cppdraft/conventions.md
Normal file
@@ -0,0 +1,610 @@
|
||||
[conventions]
|
||||
|
||||
# 16 Library introduction [[library]](./#library)
|
||||
|
||||
## 16.3 Method of description [[description]](description#conventions)
|
||||
|
||||
### 16.3.3 Other conventions [conventions]
|
||||
|
||||
#### [16.3.3.1](#general) General [[conventions.general]](conventions.general)
|
||||
|
||||
[1](#general-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L517)
|
||||
|
||||
Subclause [conventions] describes several editorial conventions used to describe the contents
|
||||
of the C++ standard library[.](#general-1.sentence-1)
|
||||
|
||||
These conventions are for describing[implementation-defined types](#type.descriptions "16.3.3.3 Type descriptions [type.descriptions]"),
|
||||
and [member functions](#functions.within.classes "16.3.3.5 Functions within classes [functions.within.classes]")[.](#general-1.sentence-2)
|
||||
|
||||
#### [16.3.3.2](#expos.only.entity) Exposition-only entities, etc. [[expos.only.entity]](expos.only.entity)
|
||||
|
||||
[1](#expos.only.entity-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L526)
|
||||
|
||||
Several entities and [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]")*s* defined in [[support]](support "17 Language support library") through [[exec]](exec "33 Execution control library") and [[depr]](depr "Annex D (normative) Compatibility features") are only defined for the purpose of exposition[.](#expos.only.entity-1.sentence-1)
|
||||
|
||||
The declaration of such an entity or [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]") is followed by a comment ending in *exposition only*[.](#expos.only.entity-1.sentence-2)
|
||||
|
||||
[2](#expos.only.entity-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L533)
|
||||
|
||||
The following are defined for exposition only
|
||||
to aid in the specification of the library:
|
||||
|
||||
[ð](#lib:decay-copy)
|
||||
|
||||
namespace std {template<class T>requires [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_to [concept.convertible]")<T, decay_t<T>>constexpr decay_t<T> *decay-copy*(T&& v) // *exposition only*noexcept(is_nothrow_convertible_v<T, decay_t<T>>){ return std::forward<T>(v); }constexpr auto *synth-three-way* = // *exposition only*[]<class T, class U>(const T& t, const U& u)requires requires {{ t < u } -> [*boolean-testable*](concept.booleantestable#concept:boolean-testable "18.5.2 Boolean testability [concept.booleantestable]"); { u < t } -> [*boolean-testable*](concept.booleantestable#concept:boolean-testable "18.5.2 Boolean testability [concept.booleantestable]"); }{if constexpr ([three_way_comparable_with](cmp.concept#concept:three_way_comparable_with "17.12.4 Concept three_way_comparable [cmp.concept]")<T, U>) {return t <=> u; } else {if (t < u) return weak_ordering::less; if (u < t) return weak_ordering::greater; return weak_ordering::equivalent; }}; template<class T, class U = T>using *synth-three-way-result* = // *exposition only*decltype(*synth-three-way*(declval<T&>(), declval<U&>()));}
|
||||
|
||||
[3](#expos.only.entity-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L567)
|
||||
|
||||
An object dst is said to be [*decay-copied from*](#def:decay-copied_from "16.3.3.2 Exposition-only entities, etc. [expos.only.entity]") a subexpression src if the type of dst isdecay_t<decltype((src))>
|
||||
|
||||
#### [16.3.3.3](#type.descriptions) Type descriptions [[type.descriptions]](type.descriptions)
|
||||
|
||||
#### [16.3.3.3.1](#type.descriptions.general) General [[type.descriptions.general]](type.descriptions.general)
|
||||
|
||||
[1](#type.descriptions.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[.](#type.descriptions.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[.](#type.descriptions.general-1.sentence-2)
|
||||
|
||||
[2](#type.descriptions.general-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L597)
|
||||
|
||||
Certain types defined in [[input.output]](input.output "31 Input/output library") are used to describe implementation-defined types[.](#type.descriptions.general-2.sentence-1)
|
||||
|
||||
They are based on other types, but with added constraints[.](#type.descriptions.general-2.sentence-2)
|
||||
|
||||
[137)](#footnote-137)[137)](#footnoteref-137)
|
||||
|
||||
Examples
|
||||
from [[utility.requirements]](utility.requirements "16.4.4 Requirements on types and expressions") include:*Cpp17EqualityComparable*,*Cpp17LessThanComparable*,*Cpp17CopyConstructible*[.](#footnote-137.sentence-1)
|
||||
|
||||
Examples from [[iterator.requirements]](iterator.requirements "24.3 Iterator 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 "31 Input/output library") are[*enumerated types*](#def:type,enumerated "16.3.3.3.2 Enumerated 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.2 Enumerated 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.2 Fundamental 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 "17 Language support library") through [[exec]](exec "33 Execution control library") and [[depr]](depr "Annex D (normative) Compatibility features") are[*bitmask types*](#def:type,bitmask "16.3.3.3.3 Bitmask 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.2 Class 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.3 Bitmask 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.3 Bitmask 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.3 Bitmask 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.3 Bitmask 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.3 Bitmask 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.1 General [character.seq.general]") may change during program execution
|
||||
by a call to setlocale(int, const char*) ([[clocale.syn]](clocale.syn "28.3.5.1 Header <clocale> synopsis")), or
|
||||
by a change to a locale object,
|
||||
as described in [[locales]](locales "28.3.3 Locales") and [[input.output]](input.output "31 Input/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.1 General [character.seq.general]") and
|
||||
the [*execution wide-character set*](#def:wide-character_set,execution "16.3.3.3.4.1 General [character.seq.general]") are supersets of the basic literal character set ([[lex.charset]](lex.charset "5.3.1 Character 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.1 General [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.1 General [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 "17 Language support library") through [[exec]](exec "33 Execution 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.1 General [character.seq.general]") is an [array object](dcl.array "9.3.4.5 Arrays [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.2 Fundamental 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.2 Byte 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.2 Byte 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.2 Byte 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.2 Byte 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.2 Byte 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.2 Byte strings [byte.strings]") is an ntbs with
|
||||
static storage duration[.](#byte.strings-4.sentence-1)[140](#footnote-140 "A string-literal, such as "abc", 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.1 Header <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.5 String 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.3 Multibyte 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.3 Multibyte 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.3 Multibyte 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.10 Function 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.6 Object concepts [concepts.object]") ([[concepts.object]](concepts.object "18.6 Object 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.2 Equality 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.1 General [dcl.decl.general]")*s*, shall model[invocable](concept.invocable#concept:invocable "18.7.2 Concept invocable [concept.invocable]")<T&, Args...>,[invocable](concept.invocable#concept:invocable "18.7.2 Concept invocable [concept.invocable]")<const T&, Args...>,[invocable](concept.invocable#concept:invocable "18.7.2 Concept invocable [concept.invocable]")<T, Args...>, and[invocable](concept.invocable#concept:invocable "18.7.2 Concept invocable [concept.invocable]")<const T, Args...> ([[concept.invocable]](concept.invocable "18.7.2 Concept 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...)
|
||||
|
||||
#### [16.3.3.4](#alg.func.obj) Algorithm function objects [[alg.func.obj]](alg.func.obj)
|
||||
|
||||
[1](#alg.func.obj-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L895)
|
||||
|
||||
An [*algorithm function object*](#def:algorithm_function_object "16.3.3.4 Algorithm function objects [alg.func.obj]") is
|
||||
a customization point object ([[customization.point.object]](#customization.point.object "16.3.3.3.5 Customization Point Object types"))
|
||||
that is specified as one or more overloaded function templates[.](#alg.func.obj-1.sentence-1)
|
||||
|
||||
The name of these function templates designates
|
||||
the corresponding algorithm function object[.](#alg.func.obj-1.sentence-2)
|
||||
|
||||
[2](#alg.func.obj-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L902)
|
||||
|
||||
For an algorithm function object o,
|
||||
let S be the corresponding set of function templates[.](#alg.func.obj-2.sentence-1)
|
||||
|
||||
Then for any sequence of arguments args …,o(args …) is expression-equivalent tos(args …),
|
||||
where the result of name lookup for s is the overload set S[.](#alg.func.obj-2.sentence-2)
|
||||
|
||||
[*Note [1](#alg.func.obj-note-1)*:
|
||||
|
||||
Algorithm function objects are not found by
|
||||
argument-dependent name lookup ([[basic.lookup.argdep]](basic.lookup.argdep "6.5.4 Argument-dependent name lookup"))[.](#alg.func.obj-2.sentence-3)
|
||||
|
||||
When found by unqualified name lookup ([[basic.lookup.unqual]](basic.lookup.unqual "6.5.3 Unqualified name lookup"))
|
||||
for the [*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1 General [expr.post.general]") in a function call ([[expr.call]](expr.call "7.6.1.3 Function call")),
|
||||
they inhibit argument-dependent name lookup[.](#alg.func.obj-2.sentence-4)
|
||||
|
||||
[*Example [1](#alg.func.obj-example-1)*: void foo() {using namespace std::ranges;
|
||||
std::vector<int> vec{1,2,3};
|
||||
find(begin(vec), end(vec), 2); // #1}
|
||||
|
||||
The function call expression at #1 invokes std::ranges::find,
|
||||
not std::find[.](#alg.func.obj-2.sentence-5)
|
||||
|
||||
â *end example*]
|
||||
|
||||
â *end note*]
|
||||
|
||||
#### [16.3.3.5](#functions.within.classes) Functions within classes [[functions.within.classes]](functions.within.classes)
|
||||
|
||||
[1](#functions.within.classes-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L930)
|
||||
|
||||
For the sake of exposition, [[support]](support "17 Language support library") through [[exec]](exec "33 Execution control library") and [[depr]](depr "Annex D (normative) Compatibility features") do not describe copy/move constructors, assignment
|
||||
operators, or (non-virtual) destructors with the same apparent
|
||||
semantics as those that can be generated
|
||||
by default ([[class.copy.ctor]](class.copy.ctor "11.4.5.3 Copy/move constructors"), [[class.copy.assign]](class.copy.assign "11.4.6 Copy/move assignment operator"), [[class.dtor]](class.dtor "11.4.7 Destructors"))[.](#functions.within.classes-1.sentence-1)
|
||||
|
||||
It is unspecified whether
|
||||
the implementation provides explicit definitions for such member function
|
||||
signatures, or for virtual destructors that can be generated by default[.](#functions.within.classes-1.sentence-2)
|
||||
|
||||
#### [16.3.3.6](#objects.within.classes) Private members [[objects.within.classes]](objects.within.classes)
|
||||
|
||||
[1](#objects.within.classes-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L945)
|
||||
|
||||
[[support]](support "17 Language support library") through [[exec]](exec "33 Execution control library") and[[depr]](depr "Annex D (normative) Compatibility features") do not specify the representation of classes, and intentionally
|
||||
omit specification of [class members](class.mem "11.4 Class members [class.mem]")[.](#objects.within.classes-1.sentence-1)
|
||||
|
||||
An implementation may
|
||||
define static or non-static class members, or both, as needed to implement the
|
||||
semantics of the member functions specified in [[support]](support "17 Language support library") through [[exec]](exec "33 Execution control library") and [[depr]](depr "Annex D (normative) Compatibility features")[.](#objects.within.classes-1.sentence-2)
|
||||
|
||||
[2](#objects.within.classes-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L953)
|
||||
|
||||
For the sake of exposition,
|
||||
some subclauses provide representative declarations, and semantic requirements, for
|
||||
private members of classes that meet the external specifications of the classes[.](#objects.within.classes-2.sentence-1)
|
||||
|
||||
The declarations for such members are
|
||||
followed by a comment that ends with *exposition only*, as in:streambuf* sb; // *exposition only*
|
||||
|
||||
[3](#objects.within.classes-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L963)
|
||||
|
||||
An implementation may use any technique that provides equivalent observable behavior[.](#objects.within.classes-3.sentence-1)
|
||||
|
||||
#### [16.3.3.7](#freestanding.item) Freestanding items [[freestanding.item]](freestanding.item)
|
||||
|
||||
[1](#freestanding.item-1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L968)
|
||||
|
||||
A [*freestanding item*](#def:freestanding_item "16.3.3.7 Freestanding items [freestanding.item]") is
|
||||
a declaration, entity, [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]"), or macro
|
||||
that is required to be present in
|
||||
a freestanding implementation and a hosted implementation[.](#freestanding.item-1.sentence-1)
|
||||
|
||||
[2](#freestanding.item-2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L975)
|
||||
|
||||
Unless otherwise specified,
|
||||
the requirements on freestanding items for a freestanding implementation
|
||||
are the same as the corresponding requirements for a hosted implementation,
|
||||
except that not all of the members of those items are required to be present[.](#freestanding.item-2.sentence-1)
|
||||
|
||||
[3](#freestanding.item-3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L981)
|
||||
|
||||
Function declarations and function template declarations
|
||||
followed by a comment that include *freestanding-deleted* are[*freestanding deleted functions*](#def:function,freestanding_deleted "16.3.3.7 Freestanding items [freestanding.item]")[.](#freestanding.item-3.sentence-1)
|
||||
|
||||
On freestanding implementations,
|
||||
it is implementation-defined
|
||||
whether each entity introduced by a freestanding deleted function
|
||||
is a deleted function ([[dcl.fct.def.delete]](dcl.fct.def.delete "9.6.3 Deleted definitions")) or
|
||||
whether the requirements are the same as
|
||||
the corresponding requirements for a hosted implementation[.](#freestanding.item-3.sentence-2)
|
||||
|
||||
[*Note [1](#freestanding.item-note-1)*:
|
||||
|
||||
Deleted definitions reduce the chance of overload resolution silently changing
|
||||
when migrating from a freestanding implementation to a hosted implementation[.](#freestanding.item-3.sentence-3)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [1](#freestanding.item-example-1)*: double abs(double j); // freestanding-deleted â *end example*]
|
||||
|
||||
[4](#freestanding.item-4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1001)
|
||||
|
||||
A declaration in a synopsis is a freestanding item if
|
||||
|
||||
- [(4.1)](#freestanding.item-4.1)
|
||||
|
||||
it is followed by a comment that includes *freestanding*,
|
||||
|
||||
- [(4.2)](#freestanding.item-4.2)
|
||||
|
||||
it is followed by a comment that includes *freestanding-deleted*, or
|
||||
|
||||
- [(4.3)](#freestanding.item-4.3)
|
||||
|
||||
the header synopsis begins with a comment
|
||||
that includes *freestanding* and
|
||||
the declaration is not followed by a comment that includes *hosted*[.](#freestanding.item-4.sentence-1)
|
||||
[*Note [2](#freestanding.item-note-2)*:
|
||||
Declarations followed by *hosted* in freestanding headers are
|
||||
not freestanding items[.](#freestanding.item-4.3.sentence-2)
|
||||
As a result, looking up the name of such functions can vary
|
||||
between hosted and freestanding implementations[.](#freestanding.item-4.3.sentence-3)
|
||||
â *end note*]
|
||||
|
||||
[*Example [2](#freestanding.item-example-2)*: // all freestandingnamespace std { â *end example*]
|
||||
|
||||
[5](#freestanding.item-5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1024)
|
||||
|
||||
An entity, deduction guide, or [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]") is a freestanding item if its introducing declaration is not followed by
|
||||
a comment that includes *hosted*, and is:
|
||||
|
||||
- [(5.1)](#freestanding.item-5.1)
|
||||
|
||||
introduced by a declaration that is a freestanding item,
|
||||
|
||||
- [(5.2)](#freestanding.item-5.2)
|
||||
|
||||
a member of a freestanding item other than a namespace,
|
||||
|
||||
- [(5.3)](#freestanding.item-5.3)
|
||||
|
||||
an enumerator of a freestanding item,
|
||||
|
||||
- [(5.4)](#freestanding.item-5.4)
|
||||
|
||||
a deduction guide of a freestanding item,
|
||||
|
||||
- [(5.5)](#freestanding.item-5.5)
|
||||
|
||||
an enclosing namespace of a freestanding item,
|
||||
|
||||
- [(5.6)](#freestanding.item-5.6)
|
||||
|
||||
a friend of a freestanding item,
|
||||
|
||||
- [(5.7)](#freestanding.item-5.7)
|
||||
|
||||
denoted by a [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]") that is a freestanding item, or
|
||||
|
||||
- [(5.8)](#freestanding.item-5.8)
|
||||
|
||||
denoted by an alias template that is a freestanding item[.](#freestanding.item-5.sentence-1)
|
||||
|
||||
[6](#freestanding.item-6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1042)
|
||||
|
||||
A macro is a freestanding item if it is defined in a header synopsis and
|
||||
|
||||
- [(6.1)](#freestanding.item-6.1)
|
||||
|
||||
the definition is followed by a comment
|
||||
that includes *freestanding*, or
|
||||
|
||||
- [(6.2)](#freestanding.item-6.2)
|
||||
|
||||
the header synopsis begins with a comment
|
||||
that includes *freestanding* and
|
||||
the definition is not followed by a comment that includes *hosted*[.](#freestanding.item-6.sentence-1)
|
||||
|
||||
[*Example [3](#freestanding.item-example-3)*: #define NULL *see below* // freestanding â *end example*]
|
||||
|
||||
[7](#freestanding.item-7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1058)
|
||||
|
||||
[*Note [3](#freestanding.item-note-3)*:
|
||||
|
||||
Freestanding annotations follow some additional exposition conventions
|
||||
that do not impose any additional normative requirements[.](#freestanding.item-7.sentence-1)
|
||||
|
||||
Header synopses that begin with a comment containing "all freestanding"
|
||||
contain no hosted items and no freestanding deleted functions[.](#freestanding.item-7.sentence-2)
|
||||
|
||||
Header synopses that begin with a comment containing "mostly freestanding"
|
||||
contain at least one hosted item or freestanding deleted function[.](#freestanding.item-7.sentence-3)
|
||||
|
||||
Classes and class templates followed by a comment
|
||||
containing "partially freestanding"
|
||||
contain at least one hosted item or freestanding deleted function[.](#freestanding.item-7.sentence-4)
|
||||
|
||||
â *end note*]
|
||||
|
||||
[*Example [4](#freestanding.item-example-4)*: template<class T, size_t N> struct array; // partially freestandingtemplate<class T, size_t N>struct array {constexpr reference operator[](size_type n); constexpr const_reference operator[](size_type n) const; constexpr reference at(size_type n); // freestanding-deletedconstexpr const_reference at(size_type n) const; // freestanding-deleted}; â *end example*]
|
||||
Reference in New Issue
Block a user