From Jason Turner

[conventions]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpiug4wp1b/{from.md → to.md} +125 -67
tmp/tmpiug4wp1b/{from.md → to.md} RENAMED
@@ -1,31 +1,63 @@
1
  ### Other conventions <a id="conventions">[[conventions]]</a>
2
 
3
  This subclause describes several editorial conventions used to describe
4
  the contents of the C++ standard library. These conventions are for
5
- describing implementation-defined types ([[type.descriptions]]), and
6
- member functions ([[functions.within.classes]]).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  #### Type descriptions <a id="type.descriptions">[[type.descriptions]]</a>
9
 
10
  ##### General <a id="type.descriptions.general">[[type.descriptions.general]]</a>
11
 
12
  The Requirements subclauses may describe names that are used to specify
13
  constraints on template arguments.[^6] These names are used in library
14
- Clauses to describe the types that may be supplied as arguments by a
15
- C++program when instantiating template components from the library.
16
 
17
- Certain types defined in Clause  [[input.output]] are used to describe
18
  implementation-defined types. They are based on other types, but with
19
  added constraints.
20
 
21
  ##### Exposition-only types <a id="expos.only.types">[[expos.only.types]]</a>
22
 
23
- Several types defined in Clauses  [[language.support]] through 
24
- [[thread]] and Annex  [[depr]] that are used as function parameter or
25
- return types are defined for the purpose of exposition only in order to
26
- capture their language linkage. The declarations of such types are
27
  followed by a comment ending in *exposition only*.
28
 
29
  [*Example 1*:
30
 
31
  ``` cpp
@@ -39,73 +71,73 @@ function that takes a callback parameter with C language linkage.
39
 
40
  — *end example*]
41
 
42
  ##### Enumerated types <a id="enumerated.types">[[enumerated.types]]</a>
43
 
44
- Several types defined in Clause  [[input.output]] are *enumerated
45
- types*. Each enumerated type may be implemented as an enumeration or as
46
- a synonym for an enumeration.[^7]
47
 
48
  The enumerated type `enumerated` can be written:
49
 
50
  ``` cpp
51
- enum enumerated { V₀, V₁, V₂, V₃, ..... };
52
 
53
  inline const enumerated C₀(V₀);
54
  inline const enumerated C₁(V₁);
55
  inline const enumerated C₂(V₂);
56
  inline const enumerated C₃(V₃);
57
- .....
58
  ```
59
 
60
  Here, the names `C₀`, `C₁`, etc. represent *enumerated elements* for
61
  this particular enumerated type. All such elements have distinct values.
62
 
63
  ##### Bitmask types <a id="bitmask.types">[[bitmask.types]]</a>
64
 
65
- Several types defined in Clauses  [[language.support]] through 
66
- [[thread]] and Annex  [[depr]] are *bitmask types*. Each bitmask type
67
- can be implemented as an enumerated type that overloads certain
68
- operators, as an integer type, or as a `bitset` ([[template.bitset]]).
69
 
70
- The bitmask type *bitmask* can be written:
71
 
72
  ``` cpp
73
  // For exposition only.
74
  // int_type is an integral type capable of representing all values of the bitmask type.
75
  enum bitmask : int_type {
76
- V₀ = 1 << 0, V₁ = 1 << 1, V₂ = 1 << 2, V₃ = 1 << 3, .....
77
  };
78
 
79
  inline constexpr bitmask C₀(V₀{});
80
  inline constexpr bitmask C₁(V₁{});
81
  inline constexpr bitmask C₂(V₂{});
82
  inline constexpr bitmask C₃(V₃{});
83
- .....
84
 
85
- constexpr bitmask{} operator&(bitmask{} X, bitmask{} Y) {
86
- return static_cast<bitmask{}>(
87
  static_cast<int_type>(X) & static_cast<int_type>(Y));
88
  }
89
- constexpr bitmask{} operator|(bitmask{} X, bitmask{} Y) {
90
- return static_cast<bitmask{}>(
91
  static_cast<int_type>(X) | static_cast<int_type>(Y));
92
  }
93
- constexpr bitmask{} operator^(bitmask{} X, bitmask{} Y){
94
- return static_cast<bitmask{}>(
95
  static_cast<int_type>(X) ^ static_cast<int_type>(Y));
96
  }
97
- constexpr bitmask{} operator~(bitmask{} X){
98
- return static_cast<bitmask{}>(~static_cast<int_type>(X));
99
  }
100
- bitmask{}& operator&=(bitmask{}& X, bitmask{} Y){
101
  X = X & Y; return X;
102
  }
103
- bitmask{}& operator|=(bitmask{}& X, bitmask{} Y) {
104
  X = X | Y; return X;
105
  }
106
- bitmask{}& operator^=(bitmask{}& X, bitmask{} Y) {
107
  X = X ^ Y; return X;
108
  }
109
  ```
110
 
111
  Here, the names `C₀`, `C₁`, etc. represent *bitmask elements* for this
@@ -132,73 +164,99 @@ sequences that follow a few uniform conventions:
132
  basic execution character set.
133
  - The *decimal-point character* is the (single-byte) character used by
134
  functions that convert between a (single-byte) character sequence and
135
  a value of one of the floating-point types. It is used in the
136
  character sequence to denote the beginning of a fractional part. It is
137
- represented in Clauses  [[language.support]] through  [[thread]] and
138
- Annex  [[depr]] by a period, `'.'`, which is also its value in the
139
- `"C"` locale, but may change during program execution by a call to
140
  `setlocale(int, const char*)`,[^8] or by a change to a `locale`
141
- object, as described in Clauses  [[locales]] and  [[input.output]].
142
- - A *character sequence* is an array object ([[dcl.array]]) `A` that
143
- can be declared as `T A[N]`, where `T` is any of the types `char`,
144
- `unsigned char`, or `signed char` ([[basic.fundamental]]), optionally
145
  qualified by any combination of `const` or `volatile`. The initial
146
  elements of the array have defined contents up to and including an
147
  element determined by some predicate. A character sequence can be
148
  designated by a pointer value `S` that points to its first element.
149
 
150
  ###### Byte strings <a id="byte.strings">[[byte.strings]]</a>
151
 
152
  A *null-terminated byte string*, or NTBS, is a character sequence whose
153
  highest-addressed element with defined content has the value zero (the
154
- *terminating null* character); no other element in the sequence has the
155
  value zero. [^9]
156
 
157
- The *length* of an NTBS is the number of elements that precede the
158
- terminating null character. An *empty* NTBS has a length of zero.
159
 
160
- The *value* of an NTBS is the sequence of values of the elements up to
161
  and including the terminating null character.
162
 
163
- A *static* NTBS is an NTBSwith static storage duration.[^10]
164
 
165
  ###### Multibyte strings <a id="multibyte.strings">[[multibyte.strings]]</a>
166
 
167
  A *null-terminated multibyte string*, or NTMBS, is an NTBS that
168
  constitutes a sequence of valid multibyte characters, beginning and
169
  ending in the initial shift state.[^11]
170
 
171
- A *static* NTMBS is an NTMBSwith static storage duration.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
 
173
  #### Functions within classes <a id="functions.within.classes">[[functions.within.classes]]</a>
174
 
175
- For the sake of exposition, Clauses  [[language.support]] through 
176
- [[thread]] and Annex  [[depr]] do not describe copy/move constructors,
177
- assignment operators, or (non-virtual) destructors with the same
178
- apparent semantics as those that can be generated by default (
179
- [[class.ctor]], [[class.dtor]], [[class.copy]]). It is unspecified
180
- whether the implementation provides explicit definitions for such member
181
- function signatures, or for virtual destructors that can be generated by
182
- default.
183
-
184
- For the sake of exposition, the library clauses sometimes annotate
185
- constructors with \EXPLICIT. Such a constructor is conditionally
186
- declared as either explicit or non-explicit ([[class.conv.ctor]]).
187
-
188
- [*Note 1*: This is typically implemented by declaring two such
189
- constructors, of which at most one participates in overload
190
- resolution. — *end note*]
191
 
192
  #### Private members <a id="objects.within.classes">[[objects.within.classes]]</a>
193
 
194
- Clauses  [[language.support]] through  [[thread]] and Annex  [[depr]] do
195
- not specify the representation of classes, and intentionally omit
196
- specification of class members ([[class.mem]]). An implementation may
197
- define static or non-static class members, or both, as needed to
198
- implement the semantics of the member functions specified in Clauses 
199
- [[language.support]] through  [[thread]] and Annex  [[depr]].
200
 
201
  For the sake of exposition, some subclauses provide representative
202
  declarations, and semantic requirements, for private members of classes
203
  that meet the external specifications of the classes. The declarations
204
  for such members are followed by a comment that ends with *exposition
 
1
  ### Other conventions <a id="conventions">[[conventions]]</a>
2
 
3
  This subclause describes several editorial conventions used to describe
4
  the contents of the C++ standard library. These conventions are for
5
+ describing implementation-defined types [[type.descriptions]], and
6
+ member functions [[functions.within.classes]].
7
+
8
+ #### Exposition-only functions <a id="expos.only.func">[[expos.only.func]]</a>
9
+
10
+ Several function templates defined in [[support]] through [[thread]] and
11
+ [[depr]] are only defined for the purpose of exposition. The declaration
12
+ of such a function is followed by a comment ending in *exposition only*.
13
+
14
+ The following are defined for exposition only to aid in the
15
+ specification of the library:
16
+
17
+ ``` cpp
18
+ template<class T> constexpr decay_t<T> decay-copy(T&& v)
19
+ noexcept(is_nothrow_convertible_v<T, decay_t<T>>) // exposition only
20
+ { return std::forward<T>(v); }
21
+
22
+ constexpr auto synth-three-way =
23
+ []<class T, class U>(const T& t, const U& u)
24
+ requires requires {
25
+ { t < u } -> boolean-testable;
26
+ { u < t } -> boolean-testable;
27
+ }
28
+ {
29
+ if constexpr (three_way_comparable_with<T, U>) {
30
+ return t <=> u;
31
+ } else {
32
+ if (t < u) return weak_ordering::less;
33
+ if (u < t) return weak_ordering::greater;
34
+ return weak_ordering::equivalent;
35
+ }
36
+ };
37
+
38
+ template<class T, class U=T>
39
+ using synth-three-way-result = decltype(synth-three-way(declval<T&>(), declval<U&>()));
40
+ ```
41
 
42
  #### Type descriptions <a id="type.descriptions">[[type.descriptions]]</a>
43
 
44
  ##### General <a id="type.descriptions.general">[[type.descriptions.general]]</a>
45
 
46
  The Requirements subclauses may describe names that are used to specify
47
  constraints on template arguments.[^6] These names are used in library
48
+ Clauses to describe the types that may be supplied as arguments by a C++
49
+ program when instantiating template components from the library.
50
 
51
+ Certain types defined in [[input.output]] are used to describe
52
  implementation-defined types. They are based on other types, but with
53
  added constraints.
54
 
55
  ##### Exposition-only types <a id="expos.only.types">[[expos.only.types]]</a>
56
 
57
+ Several types defined in [[support]] through [[thread]] and [[depr]] are
58
+ defined for the purpose of exposition. The declaration of such a type is
 
 
59
  followed by a comment ending in *exposition only*.
60
 
61
  [*Example 1*:
62
 
63
  ``` cpp
 
71
 
72
  — *end example*]
73
 
74
  ##### Enumerated types <a id="enumerated.types">[[enumerated.types]]</a>
75
 
76
+ Several types defined in [[input.output]] are *enumerated types*. Each
77
+ enumerated type may be implemented as an enumeration or as a synonym for
78
+ an enumeration.[^7]
79
 
80
  The enumerated type `enumerated` can be written:
81
 
82
  ``` cpp
83
+ enum enumerated { V₀, V₁, V₂, V₃, };
84
 
85
  inline const enumerated C₀(V₀);
86
  inline const enumerated C₁(V₁);
87
  inline const enumerated C₂(V₂);
88
  inline const enumerated C₃(V₃);
89
+
90
  ```
91
 
92
  Here, the names `C₀`, `C₁`, etc. represent *enumerated elements* for
93
  this particular enumerated type. All such elements have distinct values.
94
 
95
  ##### Bitmask types <a id="bitmask.types">[[bitmask.types]]</a>
96
 
97
+ Several types defined in [[support]] through [[thread]] and [[depr]] are
98
+ *bitmask types*. Each bitmask type can be implemented as an enumerated
99
+ type that overloads certain operators, as an integer type, or as a
100
+ `bitset` [[template.bitset]].
101
 
102
+ The bitmask type `bitmask` can be written:
103
 
104
  ``` cpp
105
  // For exposition only.
106
  // int_type is an integral type capable of representing all values of the bitmask type.
107
  enum bitmask : int_type {
108
+ V₀ = 1 << 0, V₁ = 1 << 1, V₂ = 1 << 2, V₃ = 1 << 3,
109
  };
110
 
111
  inline constexpr bitmask C₀(V₀{});
112
  inline constexpr bitmask C₁(V₁{});
113
  inline constexpr bitmask C₂(V₂{});
114
  inline constexpr bitmask C₃(V₃{});
115
+
116
 
117
+ constexpr bitmask operator&(bitmask X, bitmask Y) {
118
+ return static_cast<bitmask>(
119
  static_cast<int_type>(X) & static_cast<int_type>(Y));
120
  }
121
+ constexpr bitmask operator|(bitmask X, bitmask Y) {
122
+ return static_cast<bitmask>(
123
  static_cast<int_type>(X) | static_cast<int_type>(Y));
124
  }
125
+ constexpr bitmask operator^(bitmask X, bitmask Y){
126
+ return static_cast<bitmask>(
127
  static_cast<int_type>(X) ^ static_cast<int_type>(Y));
128
  }
129
+ constexpr bitmask operator~(bitmask X){
130
+ return static_cast<bitmask>(~static_cast<int_type>(X));
131
  }
132
+ bitmask& operator&=(bitmask& X, bitmask Y){
133
  X = X & Y; return X;
134
  }
135
+ bitmask& operator|=(bitmask& X, bitmask Y) {
136
  X = X | Y; return X;
137
  }
138
+ bitmask& operator^=(bitmask& X, bitmask Y) {
139
  X = X ^ Y; return X;
140
  }
141
  ```
142
 
143
  Here, the names `C₀`, `C₁`, etc. represent *bitmask elements* for this
 
164
  basic execution character set.
165
  - The *decimal-point character* is the (single-byte) character used by
166
  functions that convert between a (single-byte) character sequence and
167
  a value of one of the floating-point types. It is used in the
168
  character sequence to denote the beginning of a fractional part. It is
169
+ represented in [[support]] through [[thread]] and [[depr]] by a
170
+ period, `'.'`, which is also its value in the `"C"` locale, but may
171
+ change during program execution by a call to
172
  `setlocale(int, const char*)`,[^8] or by a change to a `locale`
173
+ object, as described in [[locales]] and [[input.output]].
174
+ - A *character sequence* is an array object [[dcl.array]] `A` that can
175
+ be declared as `T A[N]`, where `T` is any of the types `char`,
176
+ `unsigned char`, or `signed char` [[basic.fundamental]], optionally
177
  qualified by any combination of `const` or `volatile`. The initial
178
  elements of the array have defined contents up to and including an
179
  element determined by some predicate. A character sequence can be
180
  designated by a pointer value `S` that points to its first element.
181
 
182
  ###### Byte strings <a id="byte.strings">[[byte.strings]]</a>
183
 
184
  A *null-terminated byte string*, or NTBS, is a character sequence whose
185
  highest-addressed element with defined content has the value zero (the
186
+ *terminating null character*); no other element in the sequence has the
187
  value zero. [^9]
188
 
189
+ The *length of an NTBS* is the number of elements that precede the
190
+ terminating null character. An *empty NTBS* has a length of zero.
191
 
192
+ The *value of an NTBS* is the sequence of values of the elements up to
193
  and including the terminating null character.
194
 
195
+ A *static NTBS* is an NTBS with static storage duration.[^10]
196
 
197
  ###### Multibyte strings <a id="multibyte.strings">[[multibyte.strings]]</a>
198
 
199
  A *null-terminated multibyte string*, or NTMBS, is an NTBS that
200
  constitutes a sequence of valid multibyte characters, beginning and
201
  ending in the initial shift state.[^11]
202
 
203
+ A *static NTMBS* is an NTMBS with static storage duration.
204
+
205
+ ##### Customization Point Object types <a id="customization.point.object">[[customization.point.object]]</a>
206
+
207
+ A *customization point object* is a function object [[function.objects]]
208
+ with a literal class type that interacts with program-defined types
209
+ while enforcing semantic requirements on that interaction.
210
+
211
+ The type of a customization point object, ignoring cv-qualifiers, shall
212
+ model `semiregular` [[concepts.object]].
213
+
214
+ All instances of a specific customization point object type shall be
215
+ equal [[concepts.equality]].
216
+
217
+ The type `T` of a customization point object shall model
218
+ `invocable<const T&, Args...>` [[concept.invocable]] when the types in
219
+ `Args...` meet the requirements specified in that customization point
220
+ object’s definition. When the types of `Args...` do not meet the
221
+ customization point object’s requirements, `T` shall not have a function
222
+ call operator that participates in overload resolution.
223
+
224
+ Each customization point object type constrains its return type to model
225
+ a particular concept.
226
+
227
+ [*Note 1*: Many of the customization point objects in the library
228
+ evaluate function call expressions with an unqualified name which
229
+ results in a call to a program-defined function found by argument
230
+ dependent name lookup [[basic.lookup.argdep]]. To preclude such an
231
+ expression resulting in a call to unconstrained functions with the same
232
+ name in namespace `std`, customization point objects specify that lookup
233
+ for these expressions is performed in a context that includes deleted
234
+ overloads matching the signatures of overloads defined in namespace
235
+ `std`. When the deleted overloads are viable, program-defined overloads
236
+ need be more specialized [[temp.func.order]] or more constrained
237
+ [[temp.constr.order]] to be used by a customization point
238
+ object. — *end note*]
239
 
240
  #### Functions within classes <a id="functions.within.classes">[[functions.within.classes]]</a>
241
 
242
+ For the sake of exposition, [[support]] through [[thread]] and [[depr]]
243
+ do not describe copy/move constructors, assignment operators, or
244
+ (non-virtual) destructors with the same apparent semantics as those that
245
+ can be generated by default ([[class.copy.ctor]],
246
+ [[class.copy.assign]], [[class.dtor]]). It is unspecified whether the
247
+ implementation provides explicit definitions for such member function
248
+ signatures, or for virtual destructors that can be generated by default.
 
 
 
 
 
 
 
 
 
249
 
250
  #### Private members <a id="objects.within.classes">[[objects.within.classes]]</a>
251
 
252
+ [[support]] through [[thread]] and [[depr]] do not specify the
253
+ representation of classes, and intentionally omit specification of class
254
+ members [[class.mem]]. An implementation may define static or non-static
255
+ class members, or both, as needed to implement the semantics of the
256
+ member functions specified in [[support]] through [[thread]] and
257
+ [[depr]].
258
 
259
  For the sake of exposition, some subclauses provide representative
260
  declarations, and semantic requirements, for private members of classes
261
  that meet the external specifications of the classes. The declarations
262
  for such members are followed by a comment that ends with *exposition