- tmp/tmp6mo1c85b/{from.md → to.md} +129 -66
tmp/tmp6mo1c85b/{from.md → to.md}
RENAMED
|
@@ -1,23 +1,29 @@
|
|
| 1 |
### Other conventions <a id="conventions">[[conventions]]</a>
|
| 2 |
|
| 3 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
The following are defined for exposition only to aid in the
|
| 15 |
specification of the library:
|
| 16 |
|
| 17 |
``` cpp
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 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)
|
|
@@ -35,49 +41,33 @@ constexpr auto synth-three-way =
|
|
| 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.[^
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
| 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
|
| 64 |
-
namespace std {
|
| 65 |
-
extern "C" using some-handler = int(int, void*, double); // exposition only
|
| 66 |
-
}
|
| 67 |
-
```
|
| 68 |
-
|
| 69 |
-
The type placeholder `some-handler` can now be used to specify a
|
| 70 |
-
function that takes a callback parameter with C language linkage.
|
| 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.[^
|
| 79 |
|
| 80 |
The enumerated type `enumerated` can be written:
|
| 81 |
|
| 82 |
``` cpp
|
| 83 |
enum enumerated { V₀, V₁, V₂, V₃, … };
|
|
@@ -155,24 +145,36 @@ The following terms apply to objects and values of bitmask types:
|
|
| 155 |
- The value *Y* *is set* in the object *X* if the expression *X* `&` *Y*
|
| 156 |
is nonzero.
|
| 157 |
|
| 158 |
##### Character sequences <a id="character.seq">[[character.seq]]</a>
|
| 159 |
|
|
|
|
|
|
|
| 160 |
The C standard library makes widespread use of characters and character
|
| 161 |
sequences that follow a few uniform conventions:
|
| 162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
- A *letter* is any of the 26 lowercase or 26 uppercase letters in the
|
| 164 |
-
basic
|
| 165 |
-
- The *decimal-point character* is the (single-byte)
|
| 166 |
-
functions that convert between a (single-byte)
|
| 167 |
-
a value of one of the floating-point types. It
|
| 168 |
-
character sequence to denote the beginning of a
|
| 169 |
-
represented in [[support]] through [[thread]]
|
| 170 |
-
period, `'.'`, which is also its value in the `"C"`
|
| 171 |
-
|
| 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
|
|
@@ -194,10 +196,14 @@ 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.
|
|
@@ -210,44 +216,46 @@ 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
|
| 218 |
-
`invocable<
|
| 219 |
-
`Args...`
|
| 220 |
-
|
| 221 |
-
customization point object’s
|
| 222 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 246 |
-
[[class.copy.assign]], [[class.dtor]]
|
| 247 |
-
implementation provides explicit definitions for
|
| 248 |
-
signatures, or for virtual destructors that can be
|
|
|
|
| 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
|
|
@@ -267,5 +275,60 @@ streambuf* sb; // exposition only
|
|
| 267 |
```
|
| 268 |
|
| 269 |
An implementation may use any technique that provides equivalent
|
| 270 |
observable behavior.
|
| 271 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
### Other conventions <a id="conventions">[[conventions]]</a>
|
| 2 |
|
| 3 |
+
#### General <a id="conventions.general">[[conventions.general]]</a>
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
Subclause [[conventions]] describes several editorial conventions used
|
| 6 |
+
to describe the contents of the C++ standard library. These conventions
|
| 7 |
+
are for describing implementation-defined types [[type.descriptions]],
|
| 8 |
+
and member functions [[functions.within.classes]].
|
| 9 |
|
| 10 |
+
#### Exposition-only entities, etc. <a id="expos.only.entity">[[expos.only.entity]]</a>
|
| 11 |
+
|
| 12 |
+
Several entities and *typedef-name*s defined in [[support]] through
|
| 13 |
+
[[thread]] and [[depr]] are only defined for the purpose of exposition.
|
| 14 |
+
The declaration of such an entity or *typedef-name* is followed by a
|
| 15 |
+
comment ending in *exposition only*.
|
| 16 |
|
| 17 |
The following are defined for exposition only to aid in the
|
| 18 |
specification of the library:
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
+
namespace std {
|
| 22 |
+
template<class T>
|
| 23 |
+
requires convertible_to<T, decay_t<T>>
|
| 24 |
+
constexpr decay_t<T> decay-copy(T&& v)
|
| 25 |
noexcept(is_nothrow_convertible_v<T, decay_t<T>>) // exposition only
|
| 26 |
{ return std::forward<T>(v); }
|
| 27 |
|
| 28 |
constexpr auto synth-three-way =
|
| 29 |
[]<class T, class U>(const T& t, const U& u)
|
|
|
|
| 41 |
}
|
| 42 |
};
|
| 43 |
|
| 44 |
template<class T, class U=T>
|
| 45 |
using synth-three-way-result = decltype(synth-three-way(declval<T&>(), declval<U&>()));
|
| 46 |
+
}
|
| 47 |
```
|
| 48 |
|
| 49 |
#### Type descriptions <a id="type.descriptions">[[type.descriptions]]</a>
|
| 50 |
|
| 51 |
##### General <a id="type.descriptions.general">[[type.descriptions.general]]</a>
|
| 52 |
|
| 53 |
The Requirements subclauses may describe names that are used to specify
|
| 54 |
+
constraints on template arguments.[^7]
|
| 55 |
+
|
| 56 |
+
These names are used in library Clauses to describe the types that may
|
| 57 |
+
be supplied as arguments by a C++ program when instantiating template
|
| 58 |
+
components from the library.
|
| 59 |
|
| 60 |
Certain types defined in [[input.output]] are used to describe
|
| 61 |
implementation-defined types. They are based on other types, but with
|
| 62 |
added constraints.
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
##### Enumerated types <a id="enumerated.types">[[enumerated.types]]</a>
|
| 65 |
|
| 66 |
Several types defined in [[input.output]] are *enumerated types*. Each
|
| 67 |
enumerated type may be implemented as an enumeration or as a synonym for
|
| 68 |
+
an enumeration.[^8]
|
| 69 |
|
| 70 |
The enumerated type `enumerated` can be written:
|
| 71 |
|
| 72 |
``` cpp
|
| 73 |
enum enumerated { V₀, V₁, V₂, V₃, … };
|
|
|
|
| 145 |
- The value *Y* *is set* in the object *X* if the expression *X* `&` *Y*
|
| 146 |
is nonzero.
|
| 147 |
|
| 148 |
##### Character sequences <a id="character.seq">[[character.seq]]</a>
|
| 149 |
|
| 150 |
+
###### General <a id="character.seq.general">[[character.seq.general]]</a>
|
| 151 |
+
|
| 152 |
The C standard library makes widespread use of characters and character
|
| 153 |
sequences that follow a few uniform conventions:
|
| 154 |
|
| 155 |
+
- Properties specified as *locale-specific* may change during program
|
| 156 |
+
execution by a call to `setlocale(int, const char*)` [[clocale.syn]],
|
| 157 |
+
or by a change to a `locale` object, as described in [[locales]] and
|
| 158 |
+
[[input.output]].
|
| 159 |
+
- The *execution character set* and the *execution wide-character set*
|
| 160 |
+
are supersets of the basic literal character set [[lex.charset]]. The
|
| 161 |
+
encodings of the execution character sets and the sets of additional
|
| 162 |
+
elements (if any) are locale-specific. Each element of the execution
|
| 163 |
+
wide-character set is encoded as a single code unit representable by a
|
| 164 |
+
value of type `wchar_t`. \[*Note 1*: The encodings of the execution
|
| 165 |
+
character sets can be unrelated to any literal
|
| 166 |
+
encoding. — *end note*]
|
| 167 |
- A *letter* is any of the 26 lowercase or 26 uppercase letters in the
|
| 168 |
+
basic character set.
|
| 169 |
+
- The *decimal-point character* is the locale-specific (single-byte)
|
| 170 |
+
character used by functions that convert between a (single-byte)
|
| 171 |
+
character sequence and a value of one of the floating-point types. It
|
| 172 |
+
is used in the character sequence to denote the beginning of a
|
| 173 |
+
fractional part. It is represented in [[support]] through [[thread]]
|
| 174 |
+
and [[depr]] by a period, `'.'`, which is also its value in the `"C"`
|
| 175 |
+
locale.
|
|
|
|
|
|
|
| 176 |
- A *character sequence* is an array object [[dcl.array]] `A` that can
|
| 177 |
be declared as `T A[N]`, where `T` is any of the types `char`,
|
| 178 |
`unsigned char`, or `signed char` [[basic.fundamental]], optionally
|
| 179 |
qualified by any combination of `const` or `volatile`. The initial
|
| 180 |
elements of the array have defined contents up to and including an
|
|
|
|
| 196 |
|
| 197 |
A *static NTBS* is an NTBS with static storage duration.[^10]
|
| 198 |
|
| 199 |
###### Multibyte strings <a id="multibyte.strings">[[multibyte.strings]]</a>
|
| 200 |
|
| 201 |
+
A *multibyte character* is a sequence of one or more bytes representing
|
| 202 |
+
the code unit sequence for an encoded character of the execution
|
| 203 |
+
character set.
|
| 204 |
+
|
| 205 |
A *null-terminated multibyte string*, or NTMBS, is an NTBS that
|
| 206 |
constitutes a sequence of valid multibyte characters, beginning and
|
| 207 |
ending in the initial shift state.[^11]
|
| 208 |
|
| 209 |
A *static NTMBS* is an NTMBS with static storage duration.
|
|
|
|
| 216 |
|
| 217 |
The type of a customization point object, ignoring cv-qualifiers, shall
|
| 218 |
model `semiregular` [[concepts.object]].
|
| 219 |
|
| 220 |
All instances of a specific customization point object type shall be
|
| 221 |
+
equal [[concepts.equality]]. The effects of invoking different instances
|
| 222 |
+
of a specific customization point object type on the same arguments are
|
| 223 |
+
equivalent.
|
| 224 |
|
| 225 |
+
The type `T` of a customization point object, ignoring *cv-qualifier*s,
|
| 226 |
+
shall model `invocable<T&, Args...>`, `invocable<const T&, Args...>`,
|
| 227 |
+
`invocable<T, Args...>`, and `invocable<const T, Args...>`
|
| 228 |
+
[[concept.invocable]] when the types in `Args...` meet the requirements
|
| 229 |
+
specified in that customization point object’s definition. When the
|
| 230 |
+
types of `Args...` do not meet the customization point object’s
|
| 231 |
+
requirements, `T` shall not have a function call operator that
|
| 232 |
+
participates in overload resolution.
|
| 233 |
+
|
| 234 |
+
For a given customization point object `o`, let `p` be a variable
|
| 235 |
+
initialized as if by `auto p = o;`. Then for any sequence of arguments
|
| 236 |
+
`args...`, the following expressions have effects equivalent to
|
| 237 |
+
`o(args...)`:
|
| 238 |
+
|
| 239 |
+
- `p(args...)`
|
| 240 |
+
- `as_const(p)(args...)`
|
| 241 |
+
- `std::move(p)(args...)`
|
| 242 |
+
- `std::move(as_const(p))(args...)`
|
| 243 |
|
| 244 |
Each customization point object type constrains its return type to model
|
| 245 |
a particular concept.
|
| 246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
#### Functions within classes <a id="functions.within.classes">[[functions.within.classes]]</a>
|
| 248 |
|
| 249 |
For the sake of exposition, [[support]] through [[thread]] and [[depr]]
|
| 250 |
do not describe copy/move constructors, assignment operators, or
|
| 251 |
(non-virtual) destructors with the same apparent semantics as those that
|
| 252 |
+
can be generated by default
|
| 253 |
+
[[class.copy.ctor]], [[class.copy.assign]], [[class.dtor]]. It is
|
| 254 |
+
unspecified whether the implementation provides explicit definitions for
|
| 255 |
+
such member function signatures, or for virtual destructors that can be
|
| 256 |
+
generated by default.
|
| 257 |
|
| 258 |
#### Private members <a id="objects.within.classes">[[objects.within.classes]]</a>
|
| 259 |
|
| 260 |
[[support]] through [[thread]] and [[depr]] do not specify the
|
| 261 |
representation of classes, and intentionally omit specification of class
|
|
|
|
| 275 |
```
|
| 276 |
|
| 277 |
An implementation may use any technique that provides equivalent
|
| 278 |
observable behavior.
|
| 279 |
|
| 280 |
+
#### Freestanding items <a id="freestanding.item">[[freestanding.item]]</a>
|
| 281 |
+
|
| 282 |
+
A *freestanding item* is a declaration, entity, *typedef-name*, or macro
|
| 283 |
+
that is required to be present in a freestanding implementation and a
|
| 284 |
+
hosted implementation.
|
| 285 |
+
|
| 286 |
+
Unless otherwise specified, the requirements on freestanding items for a
|
| 287 |
+
freestanding implementation are the same as the corresponding
|
| 288 |
+
requirements for a hosted implementation, except that not all of the
|
| 289 |
+
members of the namespaces are required to be present.
|
| 290 |
+
|
| 291 |
+
[*Note 1*: This implies that freestanding item enumerations have the
|
| 292 |
+
same enumerators on freestanding implementations and hosted
|
| 293 |
+
implementations. Furthermore, class types have the same members and
|
| 294 |
+
class templates have the same deduction guides on freestanding
|
| 295 |
+
implementations and hosted implementations. — *end note*]
|
| 296 |
+
|
| 297 |
+
A declaration in a header synopsis is a freestanding item if
|
| 298 |
+
|
| 299 |
+
- it is followed by a comment that includes *freestanding*, or
|
| 300 |
+
- the header synopsis begins with a comment that includes *all
|
| 301 |
+
freestanding*.
|
| 302 |
+
|
| 303 |
+
An entity or *typedef-name* is a freestanding item if it is:
|
| 304 |
+
|
| 305 |
+
- introduced by a declaration that is a freestanding item,
|
| 306 |
+
- an enclosing namespace of a freestanding item,
|
| 307 |
+
- a friend of a freestanding item,
|
| 308 |
+
- denoted by a *typedef-name* that is a freestanding item, or
|
| 309 |
+
- denoted by an alias template that is a freestanding item.
|
| 310 |
+
|
| 311 |
+
A macro is a freestanding item if it is defined in a header synopsis and
|
| 312 |
+
|
| 313 |
+
- the definition is followed by a comment that includes *freestanding*,
|
| 314 |
+
or
|
| 315 |
+
- the header synopsis begins with a comment that includes *all
|
| 316 |
+
freestanding*.
|
| 317 |
+
|
| 318 |
+
[*Example 1*:
|
| 319 |
+
|
| 320 |
+
``` cpp
|
| 321 |
+
#define NULL see below // freestanding
|
| 322 |
+
```
|
| 323 |
+
|
| 324 |
+
— *end example*]
|
| 325 |
+
|
| 326 |
+
[*Example 2*:
|
| 327 |
+
|
| 328 |
+
``` cpp
|
| 329 |
+
// all freestanding
|
| 330 |
+
namespace std {
|
| 331 |
+
```
|
| 332 |
+
|
| 333 |
+
— *end example*]
|
| 334 |
+
|