- tmp/tmp9d3y5r6t/{from.md → to.md} +131 -39
tmp/tmp9d3y5r6t/{from.md → to.md}
RENAMED
|
@@ -7,27 +7,26 @@ 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
|
| 13 |
-
|
| 14 |
-
|
| 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>>)
|
| 26 |
{ return std::forward<T>(v); }
|
| 27 |
|
| 28 |
-
constexpr auto synth-three-way =
|
| 29 |
[]<class T, class U>(const T& t, const U& u)
|
| 30 |
requires requires {
|
| 31 |
{ t < u } -> boolean-testable;
|
| 32 |
{ u < t } -> boolean-testable;
|
| 33 |
}
|
|
@@ -40,14 +39,24 @@ namespace std {
|
|
| 40 |
return weak_ordering::equivalent;
|
| 41 |
}
|
| 42 |
};
|
| 43 |
|
| 44 |
template<class T, class U = T>
|
| 45 |
-
using synth-three-way-result =
|
|
|
|
| 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
|
|
@@ -82,11 +91,11 @@ inline const enumerated C₃(V₃);
|
|
| 82 |
Here, the names `C₀`, `C₁`, etc. represent *enumerated elements* for
|
| 83 |
this particular enumerated type. All such elements have distinct values.
|
| 84 |
|
| 85 |
##### Bitmask types <a id="bitmask.types">[[bitmask.types]]</a>
|
| 86 |
|
| 87 |
-
Several types defined in [[support]] through [[
|
| 88 |
*bitmask types*. Each bitmask type can be implemented as an enumerated
|
| 89 |
type that overloads certain operators, as an integer type, or as a
|
| 90 |
`bitset` [[template.bitset]].
|
| 91 |
|
| 92 |
The bitmask type `bitmask` can be written:
|
|
@@ -168,20 +177,22 @@ sequences that follow a few uniform conventions:
|
|
| 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 [[
|
| 174 |
-
|
| 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
|
| 181 |
element determined by some predicate. A character sequence can be
|
| 182 |
designated by a pointer value `S` that points to its first element.
|
|
|
|
|
|
|
| 183 |
|
| 184 |
###### Byte strings <a id="byte.strings">[[byte.strings]]</a>
|
| 185 |
|
| 186 |
A *null-terminated byte string*, or NTBS, is a character sequence whose
|
| 187 |
highest-addressed element with defined content has the value zero (the
|
|
@@ -239,32 +250,64 @@ initialized as if by `auto p = o;`. Then for any sequence of arguments
|
|
| 239 |
- `p(args...)`
|
| 240 |
- `as_const(p)(args...)`
|
| 241 |
- `std::move(p)(args...)`
|
| 242 |
- `std::move(as_const(p))(args...)`
|
| 243 |
|
| 244 |
-
|
| 245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
|
| 247 |
#### Functions within classes <a id="functions.within.classes">[[functions.within.classes]]</a>
|
| 248 |
|
| 249 |
-
For the sake of exposition, [[support]] through [[
|
| 250 |
-
|
| 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 [[
|
| 261 |
representation of classes, and intentionally omit specification of class
|
| 262 |
members [[class.mem]]. An implementation may define static or non-static
|
| 263 |
class members, or both, as needed to implement the semantics of the
|
| 264 |
-
member functions specified in [[support]] through [[
|
| 265 |
-
[[depr]].
|
| 266 |
|
| 267 |
For the sake of exposition, some subclauses provide representative
|
| 268 |
declarations, and semantic requirements, for private members of classes
|
| 269 |
that meet the external specifications of the classes. The declarations
|
| 270 |
for such members are followed by a comment that ends with *exposition
|
|
@@ -277,58 +320,107 @@ streambuf* sb; // exposition only
|
|
| 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,
|
| 283 |
-
|
| 284 |
-
|
| 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
|
| 290 |
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
|
|
|
|
|
|
| 296 |
|
| 297 |
-
|
|
|
|
|
|
|
| 298 |
|
| 299 |
-
|
| 300 |
-
- the header synopsis begins with a comment that includes *all
|
| 301 |
-
freestanding*.
|
| 302 |
|
| 303 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 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 *
|
| 316 |
-
|
|
|
|
| 317 |
|
| 318 |
-
[*Example
|
| 319 |
|
| 320 |
``` cpp
|
| 321 |
#define NULL see below // freestanding
|
| 322 |
```
|
| 323 |
|
| 324 |
— *end example*]
|
| 325 |
|
| 326 |
-
[*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
|
| 328 |
``` cpp
|
| 329 |
-
//
|
| 330 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 331 |
```
|
| 332 |
|
| 333 |
— *end example*]
|
| 334 |
|
|
|
|
| 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 defined in [[support]] through [[exec]] and [[depr]]
|
| 13 |
+
are only defined for the purpose of exposition. The declaration of such
|
| 14 |
+
an entity is followed by a comment ending in *exposition only*.
|
|
|
|
| 15 |
|
| 16 |
The following are defined for exposition only to aid in the
|
| 17 |
specification of the library:
|
| 18 |
|
| 19 |
``` cpp
|
| 20 |
namespace std {
|
| 21 |
template<class T>
|
| 22 |
requires convertible_to<T, decay_t<T>>
|
| 23 |
+
constexpr decay_t<T> decay-copy(T&& v) // exposition only
|
| 24 |
+
noexcept(is_nothrow_convertible_v<T, decay_t<T>>)
|
| 25 |
{ return std::forward<T>(v); }
|
| 26 |
|
| 27 |
+
constexpr auto synth-three-way = // exposition only
|
| 28 |
[]<class T, class U>(const T& t, const U& u)
|
| 29 |
requires requires {
|
| 30 |
{ t < u } -> boolean-testable;
|
| 31 |
{ u < t } -> boolean-testable;
|
| 32 |
}
|
|
|
|
| 39 |
return weak_ordering::equivalent;
|
| 40 |
}
|
| 41 |
};
|
| 42 |
|
| 43 |
template<class T, class U = T>
|
| 44 |
+
using synth-three-way-result = // exposition only
|
| 45 |
+
decltype(synth-three-way(declval<T&>(), declval<U&>()));
|
| 46 |
}
|
| 47 |
```
|
| 48 |
|
| 49 |
+
An object `dst` is said to be *decay-copied from* a subexpression `src`
|
| 50 |
+
if the type of `dst` is
|
| 51 |
+
|
| 52 |
+
``` cpp
|
| 53 |
+
decay_t<decltype((src))>
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
and `dst` is copy-initialized from `src`.
|
| 57 |
+
|
| 58 |
#### Type descriptions <a id="type.descriptions">[[type.descriptions]]</a>
|
| 59 |
|
| 60 |
##### General <a id="type.descriptions.general">[[type.descriptions.general]]</a>
|
| 61 |
|
| 62 |
The Requirements subclauses may describe names that are used to specify
|
|
|
|
| 91 |
Here, the names `C₀`, `C₁`, etc. represent *enumerated elements* for
|
| 92 |
this particular enumerated type. All such elements have distinct values.
|
| 93 |
|
| 94 |
##### Bitmask types <a id="bitmask.types">[[bitmask.types]]</a>
|
| 95 |
|
| 96 |
+
Several types defined in [[support]] through [[exec]] and [[depr]] are
|
| 97 |
*bitmask types*. Each bitmask type can be implemented as an enumerated
|
| 98 |
type that overloads certain operators, as an integer type, or as a
|
| 99 |
`bitset` [[template.bitset]].
|
| 100 |
|
| 101 |
The bitmask type `bitmask` can be written:
|
|
|
|
| 177 |
basic character set.
|
| 178 |
- The *decimal-point character* is the locale-specific (single-byte)
|
| 179 |
character used by functions that convert between a (single-byte)
|
| 180 |
character sequence and a value of one of the floating-point types. It
|
| 181 |
is used in the character sequence to denote the beginning of a
|
| 182 |
+
fractional part. It is represented in [[support]] through [[exec]] and
|
| 183 |
+
[[depr]] by a period, `'.'`, which is also its value in the `"C"`
|
| 184 |
locale.
|
| 185 |
- A *character sequence* is an array object [[dcl.array]] `A` that can
|
| 186 |
be declared as `T A[N]`, where `T` is any of the types `char`,
|
| 187 |
`unsigned char`, or `signed char` [[basic.fundamental]], optionally
|
| 188 |
qualified by any combination of `const` or `volatile`. The initial
|
| 189 |
elements of the array have defined contents up to and including an
|
| 190 |
element determined by some predicate. A character sequence can be
|
| 191 |
designated by a pointer value `S` that points to its first element.
|
| 192 |
+
- Let *`STATICALLY-WIDEN`*`<charT>("...")` be `"..."` if `charT` is
|
| 193 |
+
`char` and `L"..."` if `charT` is `wchar_t`.
|
| 194 |
|
| 195 |
###### Byte strings <a id="byte.strings">[[byte.strings]]</a>
|
| 196 |
|
| 197 |
A *null-terminated byte string*, or NTBS, is a character sequence whose
|
| 198 |
highest-addressed element with defined content has the value zero (the
|
|
|
|
| 250 |
- `p(args...)`
|
| 251 |
- `as_const(p)(args...)`
|
| 252 |
- `std::move(p)(args...)`
|
| 253 |
- `std::move(as_const(p))(args...)`
|
| 254 |
|
| 255 |
+
#### Algorithm function objects <a id="alg.func.obj">[[alg.func.obj]]</a>
|
| 256 |
+
|
| 257 |
+
An *algorithm function object* is a customization point object
|
| 258 |
+
[[customization.point.object]] that is specified as one or more
|
| 259 |
+
overloaded function templates. The name of these function templates
|
| 260 |
+
designates the corresponding algorithm function object.
|
| 261 |
+
|
| 262 |
+
For an algorithm function object `o`, let S be the corresponding set of
|
| 263 |
+
function templates. Then for any sequence of arguments `args` …,
|
| 264 |
+
`o(args` … `)` is expression-equivalent to `s(args` … `)`, where the
|
| 265 |
+
result of name lookup for `s` is the overload set S.
|
| 266 |
+
|
| 267 |
+
[*Note 1*:
|
| 268 |
+
|
| 269 |
+
Algorithm function objects are not found by argument-dependent name
|
| 270 |
+
lookup [[basic.lookup.argdep]]. When found by unqualified name lookup
|
| 271 |
+
[[basic.lookup.unqual]] for the *postfix-expression* in a function call
|
| 272 |
+
[[expr.call]], they inhibit argument-dependent name lookup.
|
| 273 |
+
|
| 274 |
+
[*Example 1*:
|
| 275 |
+
|
| 276 |
+
``` cpp
|
| 277 |
+
void foo() {
|
| 278 |
+
using namespace std::ranges;
|
| 279 |
+
std::vector<int> vec{1,2,3};
|
| 280 |
+
find(begin(vec), end(vec), 2); // #1
|
| 281 |
+
}
|
| 282 |
+
```
|
| 283 |
+
|
| 284 |
+
The function call expression at \#1 invokes `std::ranges::find`, not
|
| 285 |
+
`std::find`.
|
| 286 |
+
|
| 287 |
+
— *end example*]
|
| 288 |
+
|
| 289 |
+
— *end note*]
|
| 290 |
|
| 291 |
#### Functions within classes <a id="functions.within.classes">[[functions.within.classes]]</a>
|
| 292 |
|
| 293 |
+
For the sake of exposition, [[support]] through [[exec]] and [[depr]] do
|
| 294 |
+
not describe copy/move constructors, assignment operators, or
|
| 295 |
(non-virtual) destructors with the same apparent semantics as those that
|
| 296 |
can be generated by default
|
| 297 |
[[class.copy.ctor]], [[class.copy.assign]], [[class.dtor]]. It is
|
| 298 |
unspecified whether the implementation provides explicit definitions for
|
| 299 |
such member function signatures, or for virtual destructors that can be
|
| 300 |
generated by default.
|
| 301 |
|
| 302 |
#### Private members <a id="objects.within.classes">[[objects.within.classes]]</a>
|
| 303 |
|
| 304 |
+
[[support]] through [[exec]] and [[depr]] do not specify the
|
| 305 |
representation of classes, and intentionally omit specification of class
|
| 306 |
members [[class.mem]]. An implementation may define static or non-static
|
| 307 |
class members, or both, as needed to implement the semantics of the
|
| 308 |
+
member functions specified in [[support]] through [[exec]] and [[depr]].
|
|
|
|
| 309 |
|
| 310 |
For the sake of exposition, some subclauses provide representative
|
| 311 |
declarations, and semantic requirements, for private members of classes
|
| 312 |
that meet the external specifications of the classes. The declarations
|
| 313 |
for such members are followed by a comment that ends with *exposition
|
|
|
|
| 320 |
An implementation may use any technique that provides equivalent
|
| 321 |
observable behavior.
|
| 322 |
|
| 323 |
#### Freestanding items <a id="freestanding.item">[[freestanding.item]]</a>
|
| 324 |
|
| 325 |
+
A *freestanding item* is a declaration, entity, or macro that is
|
| 326 |
+
required to be present in a freestanding implementation and a hosted
|
| 327 |
+
implementation.
|
| 328 |
|
| 329 |
Unless otherwise specified, the requirements on freestanding items for a
|
| 330 |
freestanding implementation are the same as the corresponding
|
| 331 |
requirements for a hosted implementation, except that not all of the
|
| 332 |
+
members of those items are required to be present.
|
| 333 |
|
| 334 |
+
Function declarations and function template declarations followed by a
|
| 335 |
+
comment that include *freestanding-deleted* are *freestanding deleted
|
| 336 |
+
functions*. On freestanding implementations, it is
|
| 337 |
+
*implementation-defined* whether each entity introduced by a
|
| 338 |
+
freestanding deleted function is a deleted function
|
| 339 |
+
[[dcl.fct.def.delete]] or whether the requirements are the same as the
|
| 340 |
+
corresponding requirements for a hosted implementation.
|
| 341 |
|
| 342 |
+
[*Note 1*: Deleted definitions reduce the chance of overload resolution
|
| 343 |
+
silently changing when migrating from a freestanding implementation to a
|
| 344 |
+
hosted implementation. — *end note*]
|
| 345 |
|
| 346 |
+
[*Example 1*:
|
|
|
|
|
|
|
| 347 |
|
| 348 |
+
``` cpp
|
| 349 |
+
double abs(double j); // freestanding-deleted
|
| 350 |
+
```
|
| 351 |
+
|
| 352 |
+
— *end example*]
|
| 353 |
+
|
| 354 |
+
A declaration in a synopsis is a freestanding item if
|
| 355 |
+
|
| 356 |
+
- it is followed by a comment that includes *freestanding*,
|
| 357 |
+
- it is followed by a comment that includes *freestanding-deleted*, or
|
| 358 |
+
- the header synopsis begins with a comment that includes *freestanding*
|
| 359 |
+
and the declaration is not followed by a comment that includes
|
| 360 |
+
*hosted*. \[*Note 2*: Declarations followed by *hosted* in
|
| 361 |
+
freestanding headers are not freestanding items. As a result, looking
|
| 362 |
+
up the name of such functions can vary between hosted and freestanding
|
| 363 |
+
implementations. — *end note*]
|
| 364 |
+
|
| 365 |
+
[*Example 2*:
|
| 366 |
+
|
| 367 |
+
``` cpp
|
| 368 |
+
// all freestanding
|
| 369 |
+
namespace std {
|
| 370 |
+
```
|
| 371 |
+
|
| 372 |
+
— *end example*]
|
| 373 |
+
|
| 374 |
+
An entity or deduction guide is a freestanding item if its introducing
|
| 375 |
+
declaration is not followed by a comment that includes *hosted*, and is:
|
| 376 |
|
| 377 |
- introduced by a declaration that is a freestanding item,
|
| 378 |
+
- a member of a freestanding item other than a namespace,
|
| 379 |
+
- an enumerator of a freestanding item,
|
| 380 |
+
- a deduction guide of a freestanding item,
|
| 381 |
- an enclosing namespace of a freestanding item,
|
| 382 |
- a friend of a freestanding item,
|
| 383 |
+
- denoted by a type alias that is a freestanding item, or
|
| 384 |
- denoted by an alias template that is a freestanding item.
|
| 385 |
|
| 386 |
A macro is a freestanding item if it is defined in a header synopsis and
|
| 387 |
|
| 388 |
- the definition is followed by a comment that includes *freestanding*,
|
| 389 |
or
|
| 390 |
+
- the header synopsis begins with a comment that includes *freestanding*
|
| 391 |
+
and the definition is not followed by a comment that includes
|
| 392 |
+
*hosted*.
|
| 393 |
|
| 394 |
+
[*Example 3*:
|
| 395 |
|
| 396 |
``` cpp
|
| 397 |
#define NULL see below // freestanding
|
| 398 |
```
|
| 399 |
|
| 400 |
— *end example*]
|
| 401 |
|
| 402 |
+
[*Note 3*: Freestanding annotations follow some additional exposition
|
| 403 |
+
conventions that do not impose any additional normative requirements.
|
| 404 |
+
Header synopses that begin with a comment containing "all freestanding"
|
| 405 |
+
contain no hosted items and no freestanding deleted functions. Header
|
| 406 |
+
synopses that begin with a comment containing "mostly freestanding"
|
| 407 |
+
contain at least one hosted item or freestanding deleted function.
|
| 408 |
+
Classes and class templates followed by a comment containing "partially
|
| 409 |
+
freestanding" contain at least one hosted item or freestanding deleted
|
| 410 |
+
function. — *end note*]
|
| 411 |
+
|
| 412 |
+
[*Example 4*:
|
| 413 |
|
| 414 |
``` cpp
|
| 415 |
+
template<class T, size_t N> struct array; // partially freestanding
|
| 416 |
+
template<class T, size_t N>
|
| 417 |
+
struct array {
|
| 418 |
+
constexpr reference operator[](size_type n);
|
| 419 |
+
constexpr const_reference operator[](size_type n) const;
|
| 420 |
+
constexpr reference at(size_type n); // freestanding-deleted
|
| 421 |
+
constexpr const_reference at(size_type n) const; // freestanding-deleted
|
| 422 |
+
};
|
| 423 |
```
|
| 424 |
|
| 425 |
— *end example*]
|
| 426 |
|