- tmp/tmp3y0bhdd2/{from.md → to.md} +257 -209
tmp/tmp3y0bhdd2/{from.md → to.md}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
## Library-wide requirements <a id="requirements">[[requirements]]</a>
|
| 2 |
|
| 3 |
### General <a id="requirements.general">[[requirements.general]]</a>
|
| 4 |
|
| 5 |
Subclause [[requirements]] specifies requirements that apply to the
|
| 6 |
-
entire C++ standard library. [[support]] through [[
|
| 7 |
specify the requirements of individual entities within the library.
|
| 8 |
|
| 9 |
Requirements specified in terms of interactions between threads do not
|
| 10 |
apply to programs having only a single thread of execution.
|
| 11 |
|
|
@@ -37,15 +37,15 @@ defined within the namespace `std` or namespaces nested within namespace
|
|
| 37 |
|
| 38 |
It is unspecified whether names declared in a specific namespace are
|
| 39 |
declared directly in that namespace or in an inline namespace inside
|
| 40 |
that namespace.[^13]
|
| 41 |
|
| 42 |
-
Whenever an unqualified name other than `swap`, `make_error_code`,
|
| 43 |
-
`make_error_condition`
|
| 44 |
-
in [[support]] through [[
|
| 45 |
-
established as-if by performing unqualified
|
| 46 |
-
[[basic.lookup.unqual]] in the context of `D`.
|
| 47 |
|
| 48 |
[*Note 1*: Argument-dependent lookup is not performed. — *end note*]
|
| 49 |
|
| 50 |
Similarly, the meaning of a *qualified-id* is established as-if by
|
| 51 |
performing qualified name lookup [[basic.lookup.qual]] in the context of
|
|
@@ -58,13 +58,14 @@ performing qualified name lookup [[basic.lookup.qual]] in the context of
|
|
| 58 |
[*Note 2*: Operators in expressions [[over.match.oper]] are not so
|
| 59 |
constrained; see [[global.functions]]. — *end note*]
|
| 60 |
|
| 61 |
The meaning of the unqualified name `swap` is established in an overload
|
| 62 |
resolution context for swappable values [[swappable.requirements]]. The
|
| 63 |
-
meanings of the unqualified names `make_error_code`
|
| 64 |
-
`make_error_condition`
|
| 65 |
-
argument-dependent lookup
|
|
|
|
| 66 |
|
| 67 |
#### Headers <a id="headers">[[headers]]</a>
|
| 68 |
|
| 69 |
Each element of the C++ standard library is declared or defined (as
|
| 70 |
appropriate) in a *header*.[^14]
|
|
@@ -90,18 +91,18 @@ import <vector>; // imports the <vector> header unit
|
|
| 90 |
std::vector<int> vi; // OK
|
| 91 |
```
|
| 92 |
|
| 93 |
— *end example*]
|
| 94 |
|
| 95 |
-
Except as noted in [[library]] through [[
|
| 96 |
contents of each header `cname` is the same as that of the corresponding
|
| 97 |
header `name.h` as specified in the C standard library [[intro.refs]].
|
| 98 |
In the C++ standard library, however, the declarations (except for names
|
| 99 |
which are defined as macros in C) are within namespace scope
|
| 100 |
[[basic.scope.namespace]] of the namespace `std`. It is unspecified
|
| 101 |
whether these names (including any overloads added in [[support]]
|
| 102 |
-
through [[
|
| 103 |
namespace scope and are then injected into namespace `std` by explicit
|
| 104 |
*using-declaration*s [[namespace.udecl]].
|
| 105 |
|
| 106 |
Names which are defined as macros in C shall be defined as macros in the
|
| 107 |
C++ standard library, even if C grants license for implementation as
|
|
@@ -115,15 +116,15 @@ Names that are defined as functions in C shall be defined as functions
|
|
| 115 |
in the C++ standard library.[^16]
|
| 116 |
|
| 117 |
Identifiers that are keywords or operators in C++ shall not be defined
|
| 118 |
as macros in C++ standard library headers.[^17]
|
| 119 |
|
| 120 |
-
[[support.c.headers]]
|
| 121 |
-
|
| 122 |
|
| 123 |
-
|
| 124 |
-
associated types and macros, which “promote safer, more secure
|
| 125 |
programming” than many of the traditional C library functions. The names
|
| 126 |
of the functions have a suffix of `_s`; most of them provide the same
|
| 127 |
service as the C library function with the unsuffixed name, but
|
| 128 |
generally take an additional argument whose value is the size of the
|
| 129 |
result array. If any C++ header is included, it is
|
|
@@ -144,21 +145,23 @@ subset provided by a freestanding implementation) and the C++ headers
|
|
| 144 |
for C library facilities ([[headers.cpp.c]]). It additionally exports
|
| 145 |
declarations in the global namespace for the storage allocation and
|
| 146 |
deallocation functions that are provided by `<new>`.
|
| 147 |
|
| 148 |
The named module `std.compat` exports the same declarations as the named
|
| 149 |
-
module `std`, and additionally exports
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
|
|
|
|
|
|
| 154 |
|
| 155 |
It is unspecified to which module a declaration in the standard library
|
| 156 |
is attached.
|
| 157 |
|
| 158 |
-
[*Note 1*:
|
| 159 |
-
`
|
| 160 |
[[basic.link]]. — *end note*]
|
| 161 |
|
| 162 |
*Recommended practice:* Implementations should ensure such attachments
|
| 163 |
do not preclude further evolution or decomposition of the standard
|
| 164 |
library modules.
|
|
@@ -187,40 +190,80 @@ headers. This set shall include at least the headers shown in
|
|
| 187 |
[[headers.cpp.fs]].
|
| 188 |
|
| 189 |
**Table: C++ headers for freestanding implementations** <a id="headers.cpp.fs">[headers.cpp.fs]</a>
|
| 190 |
|
| 191 |
| Subclause | | Header |
|
| 192 |
-
| ---------------------
|
| 193 |
| [[support.types]] | Common definitions | `<cstddef>` |
|
| 194 |
-
| [[
|
|
|
|
|
|
|
| 195 |
| [[cstdint.syn]] | Integer types | `<cstdint>` |
|
| 196 |
-
| [[support.start.term]] | Start and termination | `<cstdlib>` |
|
| 197 |
| [[support.dynamic]] | Dynamic memory management | `<new>` |
|
| 198 |
| [[support.rtti]] | Type identification | `<typeinfo>` |
|
| 199 |
| [[support.srcloc]] | Source location | `<source_location>` |
|
| 200 |
| [[support.exception]] | Exception handling | `<exception>` |
|
| 201 |
| [[support.initlist]] | Initializer lists | `<initializer_list>` |
|
| 202 |
| [[cmp]] | Comparisons | `<compare>` |
|
|
|
|
| 203 |
| [[support.coroutine]] | Coroutines support | `<coroutine>` |
|
| 204 |
| [[support.runtime]] | Other runtime support | `<cstdarg>` |
|
| 205 |
| [[concepts]] | Concepts library | `<concepts>` |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 206 |
| [[type.traits]] | Type traits | `<type_traits>` |
|
| 207 |
-
| [[
|
| 208 |
-
| [[atomics]] | Atomics | `<atomic>` |
|
| 209 |
| [[utility]] | Utility components | `<utility>` |
|
| 210 |
| [[tuple]] | Tuples | `<tuple>` |
|
| 211 |
-
| [[
|
|
|
|
|
|
|
| 212 |
| [[function.objects]] | Function objects | `<functional>` |
|
| 213 |
-
| [[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
| [[iterators]] | Iterators library | `<iterator>` |
|
| 215 |
| [[ranges]] | Ranges library | `<ranges>` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
|
| 217 |
|
| 218 |
For each of the headers listed in [[headers.cpp.fs]], a freestanding
|
| 219 |
implementation provides at least the freestanding items
|
| 220 |
[[freestanding.item]] declared in the header.
|
| 221 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
### Using the library <a id="using">[[using]]</a>
|
| 223 |
|
| 224 |
#### Overview <a id="using.overview">[[using.overview]]</a>
|
| 225 |
|
| 226 |
Subclause [[using]] describes how a C++ program gains access to the
|
|
@@ -357,21 +400,21 @@ signatures is called using the default argument [[dcl.fct.default]].
|
|
| 357 |
|
| 358 |
**Table: Cpp17Destructible requirements** <a id="cpp17.destructible">[cpp17.destructible]</a>
|
| 359 |
|
| 360 |
| Expression | Post-condition |
|
| 361 |
| ---------- | --------------------------------------------------------------------- |
|
| 362 |
-
| `
|
| 363 |
| *[spans 2 columns]* *Array types and non-object types are not Cpp17Destructible.* |
|
| 364 |
|
| 365 |
|
| 366 |
#### Swappable requirements <a id="swappable.requirements">[[swappable.requirements]]</a>
|
| 367 |
|
| 368 |
This subclause provides definitions for swappable types and expressions.
|
| 369 |
In these definitions, let `t` denote an expression of type `T`, and let
|
| 370 |
`u` denote an expression of type `U`.
|
| 371 |
|
| 372 |
-
An object `t` is *swappable with* an object `u` if and only if
|
| 373 |
|
| 374 |
- the expressions `swap(t, u)` and `swap(u, t)` are valid when evaluated
|
| 375 |
in the context described below, and
|
| 376 |
- these expressions have the following effects:
|
| 377 |
- the object referred to by `t` has the value originally held by `u`
|
|
@@ -397,16 +440,15 @@ swappable requirement includes the header `<utility>` to ensure an
|
|
| 397 |
appropriate evaluation context. — *end note*]
|
| 398 |
|
| 399 |
An rvalue or lvalue `t` is *swappable* if and only if `t` is swappable
|
| 400 |
with any rvalue or lvalue, respectively, of type `T`.
|
| 401 |
|
| 402 |
-
A type `X` meets the
|
| 403 |
-
`X` are swappable.
|
| 404 |
|
| 405 |
A type `X` meeting any of the iterator requirements
|
| 406 |
-
[[iterator.requirements]] meets the
|
| 407 |
-
|
| 408 |
|
| 409 |
[*Example 1*:
|
| 410 |
|
| 411 |
User code can ensure that the evaluation of `swap` calls is performed in
|
| 412 |
an appropriate context under the various conditions as follows:
|
|
@@ -456,25 +498,27 @@ int main() {
|
|
| 456 |
— *end example*]
|
| 457 |
|
| 458 |
#### *Cpp17NullablePointer* requirements <a id="nullablepointer.requirements">[[nullablepointer.requirements]]</a>
|
| 459 |
|
| 460 |
A *Cpp17NullablePointer* type is a pointer-like type that supports null
|
| 461 |
-
values. A type `P` meets the *Cpp17NullablePointer* requirements if
|
| 462 |
|
| 463 |
- `P` meets the *Cpp17EqualityComparable*, *Cpp17DefaultConstructible*,
|
| 464 |
*Cpp17CopyConstructible*, *Cpp17CopyAssignable*, *Cpp17Swappable*, and
|
| 465 |
*Cpp17Destructible* requirements,
|
| 466 |
- the expressions shown in [[cpp17.nullablepointer]] are valid and have
|
| 467 |
the indicated semantics, and
|
| 468 |
- `P` meets all the other requirements of this subclause.
|
| 469 |
|
| 470 |
A value-initialized object of type `P` produces the null value of the
|
| 471 |
type. The null value shall be equivalent only to itself. A
|
| 472 |
-
default-initialized object of type `P` may have an indeterminate
|
|
|
|
| 473 |
|
| 474 |
[*Note 1*: Operations involving indeterminate values can cause
|
| 475 |
-
undefined behavior
|
|
|
|
| 476 |
|
| 477 |
An object `p` of type `P` can be contextually converted to `bool`
|
| 478 |
[[conv]]. The effect shall be as if `p != nullptr` had been evaluated in
|
| 479 |
place of `p`.
|
| 480 |
|
|
@@ -501,11 +545,11 @@ non-`const` lvalue of type `P`, `a` and `b` denote values of type
|
|
| 501 |
| `np != a` | | |
|
| 502 |
|
| 503 |
|
| 504 |
#### *Cpp17Hash* requirements <a id="hash.requirements">[[hash.requirements]]</a>
|
| 505 |
|
| 506 |
-
A type `H` meets the requirements if
|
| 507 |
|
| 508 |
- it is a function object type [[function.objects]],
|
| 509 |
- it meets the *Cpp17CopyConstructible* ([[cpp17.copyconstructible]])
|
| 510 |
and *Cpp17Destructible* ([[cpp17.destructible]]) requirements, and
|
| 511 |
- the expressions shown in [[cpp17.hash]] are valid and have the
|
|
@@ -528,15 +572,15 @@ The library describes a standard set of requirements for *allocators*,
|
|
| 528 |
which are class-type objects that encapsulate the information about an
|
| 529 |
allocation model. This information includes the knowledge of pointer
|
| 530 |
types, the type of their difference, the type of the size of objects in
|
| 531 |
this allocation model, as well as the memory allocation and deallocation
|
| 532 |
primitives for it. All of the string types [[strings]], containers
|
| 533 |
-
[[containers]] (except `array`), string buffers and
|
| 534 |
-
[[input.output]], and `match_results` [[re]] are
|
| 535 |
-
of allocators.
|
| 536 |
|
| 537 |
-
In
|
| 538 |
|
| 539 |
- `T`, `U`, `C` denote any cv-unqualified object type
|
| 540 |
[[term.object.type]],
|
| 541 |
- `X` denotes an allocator class for type `T`,
|
| 542 |
- `Y` denotes the corresponding allocator class for type `U`,
|
|
@@ -632,11 +676,11 @@ typename X::difference_type
|
|
| 632 |
between any two pointers in the allocation model.
|
| 633 |
|
| 634 |
*Remarks:* Default: `pointer_traits<XX::pointer>::difference_type`
|
| 635 |
|
| 636 |
``` cpp
|
| 637 |
-
typename X::
|
| 638 |
```
|
| 639 |
|
| 640 |
*Result:* `Y`
|
| 641 |
|
| 642 |
*Ensures:* For all `U` (including `T`), `YY::rebind_alloc<T>` is `X`.
|
|
@@ -863,11 +907,11 @@ X u(std::move(b));
|
|
| 863 |
*Ensures:* `u` is equal to the prior value of `X(b)`.
|
| 864 |
|
| 865 |
*Throws:* Nothing.
|
| 866 |
|
| 867 |
``` cpp
|
| 868 |
-
a.construct(c, args)
|
| 869 |
```
|
| 870 |
|
| 871 |
*Result:* (not used)
|
| 872 |
|
| 873 |
*Effects:* Constructs an object of type `C` at `c`.
|
|
@@ -1032,10 +1076,29 @@ struct SimpleAllocator {
|
|
| 1032 |
};
|
| 1033 |
```
|
| 1034 |
|
| 1035 |
— *end example*]
|
| 1036 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1037 |
##### Allocator completeness requirements <a id="allocator.requirements.completeness">[[allocator.requirements.completeness]]</a>
|
| 1038 |
|
| 1039 |
If `X` is an allocator class for type `T`, `X` additionally meets the
|
| 1040 |
allocator completeness requirements if, whether or not `T` is a complete
|
| 1041 |
type:
|
|
@@ -1065,13 +1128,16 @@ Unless otherwise specified, the behavior of a C++ program is undefined
|
|
| 1065 |
if it adds declarations or definitions to namespace `std` or to a
|
| 1066 |
namespace within namespace `std`.
|
| 1067 |
|
| 1068 |
Unless explicitly prohibited, a program may add a template
|
| 1069 |
specialization for any standard library class template to namespace
|
| 1070 |
-
`std` provided that
|
| 1071 |
-
|
| 1072 |
-
|
|
|
|
|
|
|
|
|
|
| 1073 |
|
| 1074 |
The behavior of a C++ program is undefined if it declares an explicit or
|
| 1075 |
partial specialization of any standard library variable template, except
|
| 1076 |
where explicitly permitted by the specification of that variable
|
| 1077 |
template.
|
|
@@ -1089,13 +1155,15 @@ The behavior of a C++ program is undefined if it declares
|
|
| 1089 |
- an explicit or partial specialization of any member class template of
|
| 1090 |
a standard library class or class template, or
|
| 1091 |
- a deduction guide for any standard library class template.
|
| 1092 |
|
| 1093 |
A program may explicitly instantiate a class template defined in the
|
| 1094 |
-
standard library only if the declaration
|
| 1095 |
-
|
| 1096 |
-
|
|
|
|
|
|
|
| 1097 |
|
| 1098 |
Let `F` denote a standard library function [[global.functions]], a
|
| 1099 |
standard library static member function, or an instantiation of a
|
| 1100 |
standard library function template. Unless `F` is designated an
|
| 1101 |
*addressable function*, the behavior of a C++ program is unspecified
|
|
@@ -1111,19 +1179,33 @@ Moreover, the behavior of a C++ program is unspecified (possibly
|
|
| 1111 |
ill-formed) if it attempts to form a reference to `F` or if it attempts
|
| 1112 |
to form a pointer-to-member designating either a standard library
|
| 1113 |
non-static member function [[member.functions]] or an instantiation of a
|
| 1114 |
standard library member function template.
|
| 1115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1116 |
A translation unit shall not declare namespace `std` to be an inline
|
| 1117 |
namespace [[namespace.def]].
|
| 1118 |
|
| 1119 |
##### Namespace `posix` <a id="namespace.posix">[[namespace.posix]]</a>
|
| 1120 |
|
| 1121 |
The behavior of a C++ program is undefined if it adds declarations or
|
| 1122 |
definitions to namespace `posix` or to a namespace within namespace
|
| 1123 |
`posix` unless otherwise specified. The namespace `posix` is reserved
|
| 1124 |
-
for use by
|
| 1125 |
|
| 1126 |
##### Namespaces for future standardization <a id="namespace.future">[[namespace.future]]</a>
|
| 1127 |
|
| 1128 |
Top-level namespaces whose *namespace-name* consists of `std` followed
|
| 1129 |
by one or more *digit*s [[lex.name]] are reserved for future
|
|
@@ -1147,89 +1229,29 @@ If a program declares or defines a name in a context where it is
|
|
| 1147 |
reserved, other than as explicitly allowed by [[library]], its behavior
|
| 1148 |
is undefined.
|
| 1149 |
|
| 1150 |
##### Zombie names <a id="zombie.names">[[zombie.names]]</a>
|
| 1151 |
|
| 1152 |
-
In namespace `std`, the
|
| 1153 |
-
standardization:
|
| 1154 |
|
| 1155 |
-
|
| 1156 |
-
|
| 1157 |
-
|
| 1158 |
-
- `binary_negate`,
|
| 1159 |
-
- `bind1st`,
|
| 1160 |
-
- `bind2nd`,
|
| 1161 |
-
- `binder1st`,
|
| 1162 |
-
- `binder2nd`,
|
| 1163 |
-
- `const_mem_fun1_ref_t`,
|
| 1164 |
-
- `const_mem_fun1_t`,
|
| 1165 |
-
- `const_mem_fun_ref_t`,
|
| 1166 |
-
- `const_mem_fun_t`,
|
| 1167 |
-
- `declare_no_pointers`,
|
| 1168 |
-
- `declare_reachable`,
|
| 1169 |
-
- `get_pointer_safety`,
|
| 1170 |
-
- `get_temporary_buffer`,
|
| 1171 |
-
- `get_unexpected`,
|
| 1172 |
-
- `gets`,
|
| 1173 |
-
- `is_literal_type`,
|
| 1174 |
-
- `is_literal_type_v`,
|
| 1175 |
-
- `mem_fun1_ref_t`,
|
| 1176 |
-
- `mem_fun1_t`,
|
| 1177 |
-
- `mem_fun_ref_t`,
|
| 1178 |
-
- `mem_fun_ref`,
|
| 1179 |
-
- `mem_fun_t`,
|
| 1180 |
-
- `mem_fun`,
|
| 1181 |
-
- `not1`,
|
| 1182 |
-
- `not2`,
|
| 1183 |
-
- `pointer_safety`,
|
| 1184 |
-
- `pointer_to_binary_function`,
|
| 1185 |
-
- `pointer_to_unary_function`,
|
| 1186 |
-
- `ptr_fun`,
|
| 1187 |
-
- `random_shuffle`,
|
| 1188 |
-
- `raw_storage_iterator`,
|
| 1189 |
-
- `result_of`,
|
| 1190 |
-
- `result_of_t`,
|
| 1191 |
-
- `return_temporary_buffer`,
|
| 1192 |
-
- `set_unexpected`,
|
| 1193 |
-
- `unary_function`,
|
| 1194 |
-
- `unary_negate`,
|
| 1195 |
-
- `uncaught_exception`,
|
| 1196 |
-
- `undeclare_no_pointers`,
|
| 1197 |
-
- `undeclare_reachable`, and
|
| 1198 |
-
- `unexpected_handler`.
|
| 1199 |
|
| 1200 |
-
The
|
| 1201 |
-
standardization, and may not be used as a name
|
| 1202 |
-
portable code:
|
| 1203 |
|
| 1204 |
-
|
| 1205 |
-
|
| 1206 |
-
- `io_state`,
|
| 1207 |
-
- `open_mode`,
|
| 1208 |
-
- `preferred`,
|
| 1209 |
-
- `second_argument_type`,
|
| 1210 |
-
- `seek_dir`, and.
|
| 1211 |
-
- `strict`.
|
| 1212 |
-
|
| 1213 |
-
The name `stossc` is reserved as a member function for previous
|
| 1214 |
-
standardization, and may not be used as a name for function-like macros
|
| 1215 |
-
in portable code.
|
| 1216 |
-
|
| 1217 |
-
The header names `<ccomplex>`, `<ciso646>`, `<cstdalign>`, `<cstdbool>`,
|
| 1218 |
-
and `<ctgmath>` are reserved for previous standardization.
|
| 1219 |
|
| 1220 |
##### Macro names <a id="macro.names">[[macro.names]]</a>
|
| 1221 |
|
| 1222 |
A translation unit that includes a standard library header shall not
|
| 1223 |
`#define` or `#undef` names declared in any standard library header.
|
| 1224 |
|
| 1225 |
-
A translation unit shall not `#define` or `#undef` names lexically
|
| 1226 |
-
identical to keywords, to the identifiers listed in
|
| 1227 |
-
[[lex.name.special]], or to the *attribute-token*s described in
|
| 1228 |
-
[[dcl.attr]], except that the names `likely` and `unlikely` may be
|
| 1229 |
-
defined as function-like macros [[cpp.replace]].
|
| 1230 |
-
|
| 1231 |
##### External linkage <a id="extern.names">[[extern.names]]</a>
|
| 1232 |
|
| 1233 |
Each name declared as an object with external linkage in a header is
|
| 1234 |
reserved to the implementation to designate that library object with
|
| 1235 |
external linkage, [^22]
|
|
@@ -1277,56 +1299,15 @@ Virtual member function signatures defined for a base class in the C++
|
|
| 1277 |
standard library may be overridden in a derived class defined in the
|
| 1278 |
program [[class.virtual]].
|
| 1279 |
|
| 1280 |
#### Replacement functions <a id="replacement.functions">[[replacement.functions]]</a>
|
| 1281 |
|
| 1282 |
-
[[support]] through [[
|
| 1283 |
-
|
| 1284 |
-
|
| 1285 |
-
|
| 1286 |
-
|
| 1287 |
-
A C++ program may provide the definition for any of the following
|
| 1288 |
-
dynamic memory allocation function signatures declared in header `<new>`
|
| 1289 |
-
[[basic.stc.dynamic]], [[new.syn]]:
|
| 1290 |
-
|
| 1291 |
-
``` cpp
|
| 1292 |
-
operator new(std::size_t)
|
| 1293 |
-
operator new(std::size_t, std::align_val_t)
|
| 1294 |
-
operator new(std::size_t, const std::nothrow_t&)
|
| 1295 |
-
operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
|
| 1296 |
-
```
|
| 1297 |
-
|
| 1298 |
-
``` cpp
|
| 1299 |
-
operator delete(void*)
|
| 1300 |
-
operator delete(void*, std::size_t)
|
| 1301 |
-
operator delete(void*, std::align_val_t)
|
| 1302 |
-
operator delete(void*, std::size_t, std::align_val_t)
|
| 1303 |
-
operator delete(void*, const std::nothrow_t&)
|
| 1304 |
-
operator delete(void*, std::align_val_t, const std::nothrow_t&)
|
| 1305 |
-
```
|
| 1306 |
-
|
| 1307 |
-
``` cpp
|
| 1308 |
-
operator new[](std::size_t)
|
| 1309 |
-
operator new[](std::size_t, std::align_val_t)
|
| 1310 |
-
operator new[](std::size_t, const std::nothrow_t&)
|
| 1311 |
-
operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
|
| 1312 |
-
```
|
| 1313 |
-
|
| 1314 |
-
``` cpp
|
| 1315 |
-
operator delete[](void*)
|
| 1316 |
-
operator delete[](void*, std::size_t)
|
| 1317 |
-
operator delete[](void*, std::align_val_t)
|
| 1318 |
-
operator delete[](void*, std::size_t, std::align_val_t)
|
| 1319 |
-
operator delete[](void*, const std::nothrow_t&)
|
| 1320 |
-
operator delete[](void*, std::align_val_t, const std::nothrow_t&)
|
| 1321 |
-
```
|
| 1322 |
-
|
| 1323 |
-
The program’s definitions are used instead of the default versions
|
| 1324 |
-
supplied by the implementation [[new.delete]]. Such replacement occurs
|
| 1325 |
-
prior to program startup [[basic.def.odr]], [[basic.start]]. The
|
| 1326 |
-
program’s declarations shall not be specified as `inline`. No diagnostic
|
| 1327 |
-
is required.
|
| 1328 |
|
| 1329 |
#### Handler functions <a id="handler.functions">[[handler.functions]]</a>
|
| 1330 |
|
| 1331 |
The C++ standard library provides a default version of the following
|
| 1332 |
handler function [[support]]:
|
|
@@ -1347,14 +1328,14 @@ A C++ program can get a pointer to the current handler function by
|
|
| 1347 |
calling the following functions:
|
| 1348 |
|
| 1349 |
- `get_new_handler`
|
| 1350 |
- `get_terminate`
|
| 1351 |
|
| 1352 |
-
Calling the `set_*` and `get_*` functions shall not incur a data race
|
| 1353 |
-
call to any of the `set_*` functions
|
| 1354 |
-
calls to the same `set_*` function and to the
|
| 1355 |
-
function.
|
| 1356 |
|
| 1357 |
#### Other functions <a id="res.on.functions">[[res.on.functions]]</a>
|
| 1358 |
|
| 1359 |
In certain cases (replacement functions, handler functions, operations
|
| 1360 |
on types used to instantiate standard library template components), the
|
|
@@ -1362,13 +1343,13 @@ C++ standard library depends on components supplied by a C++ program. If
|
|
| 1362 |
these components do not meet their requirements, this document places no
|
| 1363 |
requirements on the implementation.
|
| 1364 |
|
| 1365 |
In particular, the behavior is undefined in the following cases:
|
| 1366 |
|
| 1367 |
-
- For replacement functions [[
|
| 1368 |
-
function does not implement the semantics of the
|
| 1369 |
-
behavior:* paragraph.
|
| 1370 |
- For handler functions [[new.handler]], [[terminate.handler]], if the
|
| 1371 |
installed handler function does not implement the semantics of the
|
| 1372 |
applicable *Required behavior:* paragraph.
|
| 1373 |
- For types used as template arguments when instantiating a template
|
| 1374 |
component, if the operations on the type do not implement the
|
|
@@ -1396,11 +1377,11 @@ the C++ standard library, unless explicitly stated otherwise.
|
|
| 1396 |
address computations and accesses to objects (that would be valid if
|
| 1397 |
the pointer did point to the first element of such an array) are in
|
| 1398 |
fact valid.
|
| 1399 |
- If a function argument is bound to an rvalue reference parameter, the
|
| 1400 |
implementation may assume that this parameter is a unique reference to
|
| 1401 |
-
this argument, except that the argument passed to a move
|
| 1402 |
operator may be a reference to `*this` [[lib.types.movedfrom]].
|
| 1403 |
\[*Note 1*: If the type of a parameter is a forwarding reference
|
| 1404 |
[[temp.deduct.call]] that is deduced to an lvalue reference type, then
|
| 1405 |
the argument is not bound to an rvalue reference. — *end note*]
|
| 1406 |
\[*Note 2*: If a program casts an lvalue to an xvalue while passing
|
|
@@ -1449,16 +1430,21 @@ program is ill-formed, no diagnostic required.
|
|
| 1449 |
#### Overview <a id="conforming.overview">[[conforming.overview]]</a>
|
| 1450 |
|
| 1451 |
Subclause [[conforming]] describes the constraints upon, and latitude
|
| 1452 |
of, implementations of the C++ standard library.
|
| 1453 |
|
| 1454 |
-
An implementation’s use of
|
| 1455 |
-
|
| 1456 |
-
|
| 1457 |
-
|
| 1458 |
-
|
| 1459 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1460 |
|
| 1461 |
#### Headers <a id="res.on.headers">[[res.on.headers]]</a>
|
| 1462 |
|
| 1463 |
A C++ header may include other C++ headers. A C++ header shall provide
|
| 1464 |
the declarations and definitions that appear in its synopsis. A C++
|
|
@@ -1488,11 +1474,11 @@ stated otherwise.
|
|
| 1488 |
|
| 1489 |
It is unspecified whether any non-member functions in the C++ standard
|
| 1490 |
library are defined as inline [[dcl.inline]].
|
| 1491 |
|
| 1492 |
A call to a non-member function signature described in [[support]]
|
| 1493 |
-
through [[
|
| 1494 |
declared no additional non-member function signatures.[^25]
|
| 1495 |
|
| 1496 |
An implementation shall not declare a non-member function signature with
|
| 1497 |
additional default arguments.
|
| 1498 |
|
|
@@ -1540,12 +1526,12 @@ signatures for a member function name. — *end note*]
|
|
| 1540 |
Whenever this document specifies a friend declaration of a function or
|
| 1541 |
function template within a class or class template definition, that
|
| 1542 |
declaration shall be the only declaration of that function or function
|
| 1543 |
template provided by an implementation.
|
| 1544 |
|
| 1545 |
-
[*Note 1*: In particular,
|
| 1546 |
-
|
| 1547 |
namespace scope. — *end note*]
|
| 1548 |
|
| 1549 |
[*Note 2*: Such a friend function or function template declaration is
|
| 1550 |
known as a hidden friend, as it is visible neither to ordinary
|
| 1551 |
unqualified lookup [[basic.lookup.unqual]] nor to qualified lookup
|
|
@@ -1555,12 +1541,12 @@ unqualified lookup [[basic.lookup.unqual]] nor to qualified lookup
|
|
| 1555 |
|
| 1556 |
This document explicitly requires that certain standard library
|
| 1557 |
functions are `constexpr` [[dcl.constexpr]]. An implementation shall not
|
| 1558 |
declare any standard library function signature as `constexpr` except
|
| 1559 |
for those where it is explicitly required. Within any header that
|
| 1560 |
-
provides any non-defining declarations of constexpr functions
|
| 1561 |
-
|
| 1562 |
|
| 1563 |
#### Requirements for stable algorithms <a id="algorithm.stable">[[algorithm.stable]]</a>
|
| 1564 |
|
| 1565 |
When the requirements for an algorithm state that it is “stable” without
|
| 1566 |
further elaboration, it means:
|
|
@@ -1625,14 +1611,32 @@ all operations solely within the current thread if those operations have
|
|
| 1625 |
effects that are visible [[intro.multithread]] to users.
|
| 1626 |
|
| 1627 |
[*Note 3*: This allows implementations to parallelize operations if
|
| 1628 |
there are no visible side effects. — *end note*]
|
| 1629 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1630 |
#### Protection within classes <a id="protection.within.classes">[[protection.within.classes]]</a>
|
| 1631 |
|
| 1632 |
It is unspecified whether any function signature or class described in
|
| 1633 |
-
[[support]] through [[
|
| 1634 |
in the C++ standard library.
|
| 1635 |
|
| 1636 |
#### Derived classes <a id="derivation">[[derivation]]</a>
|
| 1637 |
|
| 1638 |
An implementation may derive any class in the C++ standard library from
|
|
@@ -1660,21 +1664,22 @@ types unless otherwise specified.
|
|
| 1660 |
#### Restrictions on exception handling <a id="res.on.exception.handling">[[res.on.exception.handling]]</a>
|
| 1661 |
|
| 1662 |
Any of the functions defined in the C++ standard library can report a
|
| 1663 |
failure by throwing an exception of a type described in its *Throws:*
|
| 1664 |
paragraph, or of a type derived from a type named in the *Throws:*
|
| 1665 |
-
paragraph that would be caught by
|
| 1666 |
-
type.
|
| 1667 |
|
| 1668 |
Functions from the C standard library shall not throw exceptions [^26]
|
| 1669 |
|
| 1670 |
except when such a function calls a program-supplied function that
|
| 1671 |
throws an exception.[^27]
|
| 1672 |
|
| 1673 |
Destructor operations defined in the C++ standard library shall not
|
| 1674 |
throw exceptions. Every destructor in the C++ standard library shall
|
| 1675 |
-
behave as if it had a non-throwing exception specification
|
|
|
|
| 1676 |
|
| 1677 |
Functions defined in the C++ standard library that do not have a
|
| 1678 |
*Throws:* paragraph but do have a potentially-throwing exception
|
| 1679 |
specification may throw *implementation-defined* exceptions.[^28]
|
| 1680 |
|
|
@@ -1683,15 +1688,22 @@ derived from the standard exception classes
|
|
| 1683 |
[[bad.alloc]], [[support.exception]], [[std.exceptions]].
|
| 1684 |
|
| 1685 |
An implementation may strengthen the exception specification for a
|
| 1686 |
non-virtual function by adding a non-throwing exception specification.
|
| 1687 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1688 |
#### Value of error codes <a id="value.error.codes">[[value.error.codes]]</a>
|
| 1689 |
|
| 1690 |
Certain functions in the C++ standard library report errors via a
|
| 1691 |
-
`
|
| 1692 |
-
`category()` member shall return `
|
| 1693 |
originating from the operating system, or a reference to an
|
| 1694 |
*implementation-defined* `error_category` object for errors originating
|
| 1695 |
elsewhere. The implementation shall define the possible values of
|
| 1696 |
`value()` for each of these error categories.
|
| 1697 |
|
|
@@ -1707,56 +1719,65 @@ associated values. — *end example*]
|
|
| 1707 |
#### Moved-from state of library types <a id="lib.types.movedfrom">[[lib.types.movedfrom]]</a>
|
| 1708 |
|
| 1709 |
Objects of types defined in the C++ standard library may be moved from
|
| 1710 |
[[class.copy.ctor]]. Move operations may be explicitly specified or
|
| 1711 |
implicitly generated. Unless otherwise specified, such moved-from
|
| 1712 |
-
objects shall be placed in a valid but unspecified state
|
|
|
|
| 1713 |
|
| 1714 |
An object of a type defined in the C++ standard library may be
|
| 1715 |
move-assigned [[class.copy.assign]] to itself. Unless otherwise
|
| 1716 |
specified, such an assignment places the object in a valid but
|
| 1717 |
unspecified state.
|
| 1718 |
|
| 1719 |
<!-- Link reference definitions -->
|
| 1720 |
[alg.c.library]: algorithms.md#alg.c.library
|
|
|
|
| 1721 |
[alg.sorting]: algorithms.md#alg.sorting
|
| 1722 |
[algorithm.stable]: #algorithm.stable
|
| 1723 |
[algorithms]: algorithms.md#algorithms
|
| 1724 |
[algorithms.requirements]: algorithms.md#algorithms.requirements
|
| 1725 |
[alloc.errors]: support.md#alloc.errors
|
| 1726 |
[allocator.requirements]: #allocator.requirements
|
| 1727 |
[allocator.requirements.completeness]: #allocator.requirements.completeness
|
| 1728 |
[allocator.requirements.general]: #allocator.requirements.general
|
| 1729 |
[allocator.traits]: mem.md#allocator.traits
|
| 1730 |
[alt.headers]: #alt.headers
|
|
|
|
| 1731 |
[array.creation]: containers.md#array.creation
|
| 1732 |
[atomics]: thread.md#atomics
|
| 1733 |
[bad.alloc]: support.md#bad.alloc
|
|
|
|
|
|
|
| 1734 |
[basic.def.odr]: basic.md#basic.def.odr
|
| 1735 |
[basic.fundamental]: basic.md#basic.fundamental
|
|
|
|
| 1736 |
[basic.life]: basic.md#basic.life
|
| 1737 |
[basic.link]: basic.md#basic.link
|
| 1738 |
[basic.lookup.argdep]: basic.md#basic.lookup.argdep
|
| 1739 |
[basic.lookup.qual]: basic.md#basic.lookup.qual
|
| 1740 |
[basic.lookup.unqual]: basic.md#basic.lookup.unqual
|
| 1741 |
[basic.scope.namespace]: basic.md#basic.scope.namespace
|
| 1742 |
-
[basic.start]: basic.md#basic.start
|
| 1743 |
[basic.stc.dynamic]: basic.md#basic.stc.dynamic
|
| 1744 |
[bit]: utilities.md#bit
|
| 1745 |
[bitmask.types]: #bitmask.types
|
| 1746 |
[byte.strings]: #byte.strings
|
| 1747 |
[c.annex.k.names]: #c.annex.k.names
|
|
|
|
|
|
|
| 1748 |
[cassert.syn]: diagnostics.md#cassert.syn
|
| 1749 |
[cerrno.syn]: diagnostics.md#cerrno.syn
|
| 1750 |
[character.seq]: #character.seq
|
| 1751 |
[character.seq.general]: #character.seq.general
|
|
|
|
| 1752 |
[class.copy.assign]: class.md#class.copy.assign
|
| 1753 |
[class.copy.ctor]: class.md#class.copy.ctor
|
| 1754 |
[class.dtor]: class.md#class.dtor
|
| 1755 |
[class.mem]: class.md#class.mem
|
|
|
|
| 1756 |
[class.virtual]: class.md#class.virtual
|
| 1757 |
-
[clocale.syn]:
|
| 1758 |
[cmp]: support.md#cmp
|
| 1759 |
[compliance]: #compliance
|
| 1760 |
[concept.destructible]: concepts.md#concept.destructible
|
| 1761 |
[concept.invocable]: concepts.md#concept.invocable
|
| 1762 |
[concept.totallyordered]: concepts.md#concept.totallyordered
|
|
@@ -1774,40 +1795,51 @@ unspecified state.
|
|
| 1774 |
[conv]: expr.md#conv
|
| 1775 |
[conv.func]: expr.md#conv.func
|
| 1776 |
[conventions]: #conventions
|
| 1777 |
[conventions.general]: #conventions.general
|
| 1778 |
[cpp.include]: cpp.md#cpp.include
|
| 1779 |
-
[cpp.replace]: cpp.md#cpp.replace
|
| 1780 |
[cpp17.copyassignable]: #cpp17.copyassignable
|
| 1781 |
[cpp17.copyconstructible]: #cpp17.copyconstructible
|
| 1782 |
[cpp17.destructible]: #cpp17.destructible
|
| 1783 |
[cpp17.hash]: #cpp17.hash
|
| 1784 |
[cpp17.moveassignable]: #cpp17.moveassignable
|
| 1785 |
[cpp17.nullablepointer]: #cpp17.nullablepointer
|
| 1786 |
[cstdarg.syn]: support.md#cstdarg.syn
|
| 1787 |
[cstddef.syn]: support.md#cstddef.syn
|
| 1788 |
[cstdint.syn]: support.md#cstdint.syn
|
|
|
|
| 1789 |
[customization.point.object]: #customization.point.object
|
| 1790 |
[dcl.array]: dcl.md#dcl.array
|
| 1791 |
-
[dcl.attr]: dcl.md#dcl.attr
|
| 1792 |
[dcl.constexpr]: dcl.md#dcl.constexpr
|
|
|
|
|
|
|
| 1793 |
[dcl.fct.default]: dcl.md#dcl.fct.default
|
| 1794 |
[dcl.init]: dcl.md#dcl.init
|
| 1795 |
[dcl.inline]: dcl.md#dcl.inline
|
| 1796 |
[dcl.link]: dcl.md#dcl.link
|
| 1797 |
[dcl.pre]: dcl.md#dcl.pre
|
| 1798 |
[dcl.typedef]: dcl.md#dcl.typedef
|
|
|
|
|
|
|
| 1799 |
[defns.nonconst.libcall]: intro.md#defns.nonconst.libcall
|
|
|
|
| 1800 |
[depr]: future.md#depr
|
| 1801 |
[derivation]: #derivation
|
| 1802 |
[derived.classes]: #derived.classes
|
| 1803 |
[description]: #description
|
| 1804 |
[description.general]: #description.general
|
| 1805 |
[diagnostics]: diagnostics.md#diagnostics
|
| 1806 |
[enumerated.types]: #enumerated.types
|
|
|
|
| 1807 |
[except]: except.md#except
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1808 |
[expos.only.entity]: #expos.only.entity
|
|
|
|
| 1809 |
[expr.delete]: expr.md#expr.delete
|
| 1810 |
[expr.new]: expr.md#expr.new
|
| 1811 |
[expr.unary.op]: expr.md#expr.unary.op
|
| 1812 |
[extern.names]: #extern.names
|
| 1813 |
[extern.types]: #extern.types
|
|
@@ -1820,28 +1852,29 @@ unspecified state.
|
|
| 1820 |
[headers]: #headers
|
| 1821 |
[headers.cpp]: #headers.cpp
|
| 1822 |
[headers.cpp.c]: #headers.cpp.c
|
| 1823 |
[headers.cpp.fs]: #headers.cpp.fs
|
| 1824 |
[hidden.friends]: #hidden.friends
|
|
|
|
| 1825 |
[input.output]: input.md#input.output
|
| 1826 |
[intro.compliance]: intro.md#intro.compliance
|
| 1827 |
[intro.multithread]: basic.md#intro.multithread
|
|
|
|
| 1828 |
[intro.refs]: intro.md#intro.refs
|
| 1829 |
[iterator.requirements]: iterators.md#iterator.requirements
|
| 1830 |
[iterators]: iterators.md#iterators
|
| 1831 |
[lex.charset]: lex.md#lex.charset
|
| 1832 |
[lex.name]: lex.md#lex.name
|
| 1833 |
-
[lex.name.special]: #lex.name.special
|
| 1834 |
[lex.phases]: lex.md#lex.phases
|
| 1835 |
[lex.separate]: lex.md#lex.separate
|
| 1836 |
[lib.types.movedfrom]: #lib.types.movedfrom
|
| 1837 |
[library]: #library
|
| 1838 |
[library.c]: #library.c
|
| 1839 |
[library.categories]: #library.categories
|
|
|
|
| 1840 |
[library.general]: #library.general
|
| 1841 |
-
[locales]:
|
| 1842 |
-
[localization]: localization.md#localization
|
| 1843 |
[macro.names]: #macro.names
|
| 1844 |
[mem]: mem.md#mem
|
| 1845 |
[member.functions]: #member.functions
|
| 1846 |
[memory]: mem.md#memory
|
| 1847 |
[meta]: meta.md#meta
|
|
@@ -1851,32 +1884,34 @@ unspecified state.
|
|
| 1851 |
[namespace.def]: dcl.md#namespace.def
|
| 1852 |
[namespace.future]: #namespace.future
|
| 1853 |
[namespace.posix]: #namespace.posix
|
| 1854 |
[namespace.std]: #namespace.std
|
| 1855 |
[namespace.udecl]: dcl.md#namespace.udecl
|
| 1856 |
-
[new.delete]: support.md#new.delete
|
| 1857 |
[new.handler]: support.md#new.handler
|
| 1858 |
-
[new.syn]: support.md#new.syn
|
| 1859 |
[nullablepointer.requirements]: #nullablepointer.requirements
|
| 1860 |
[numeric.requirements]: numerics.md#numeric.requirements
|
| 1861 |
[numerics]: numerics.md#numerics
|
|
|
|
| 1862 |
[objects.within.classes]: #objects.within.classes
|
|
|
|
| 1863 |
[organization]: #organization
|
| 1864 |
[organization.general]: #organization.general
|
| 1865 |
[ostream.iterator.ops]: iterators.md#ostream.iterator.ops
|
| 1866 |
[over.literal]: over.md#over.literal
|
| 1867 |
[over.match]: over.md#over.match
|
| 1868 |
[over.match.oper]: over.md#over.match.oper
|
| 1869 |
[protection.within.classes]: #protection.within.classes
|
|
|
|
| 1870 |
[random.access.iterators]: iterators.md#random.access.iterators
|
| 1871 |
[ranges]: ranges.md#ranges
|
| 1872 |
[ratio]: meta.md#ratio
|
| 1873 |
-
[re]:
|
| 1874 |
[reentrancy]: #reentrancy
|
| 1875 |
[replacement.functions]: #replacement.functions
|
| 1876 |
[requirements]: #requirements
|
| 1877 |
[requirements.general]: #requirements.general
|
|
|
|
| 1878 |
[res.on.arguments]: #res.on.arguments
|
| 1879 |
[res.on.data.races]: #res.on.data.races
|
| 1880 |
[res.on.exception.handling]: #res.on.exception.handling
|
| 1881 |
[res.on.functions]: #res.on.functions
|
| 1882 |
[res.on.headers]: #res.on.headers
|
|
@@ -1886,31 +1921,34 @@ unspecified state.
|
|
| 1886 |
[reserved.names]: #reserved.names
|
| 1887 |
[reserved.names.general]: #reserved.names.general
|
| 1888 |
[specialized.addressof]: mem.md#specialized.addressof
|
| 1889 |
[std.exceptions]: diagnostics.md#std.exceptions
|
| 1890 |
[std.modules]: #std.modules
|
|
|
|
| 1891 |
[stmt.return]: stmt.md#stmt.return
|
| 1892 |
[stream.types]: input.md#stream.types
|
|
|
|
|
|
|
| 1893 |
[strings]: strings.md#strings
|
| 1894 |
[structure]: #structure
|
| 1895 |
[structure.elements]: #structure.elements
|
| 1896 |
[structure.requirements]: #structure.requirements
|
| 1897 |
[structure.see.also]: #structure.see.also
|
| 1898 |
[structure.specifications]: #structure.specifications
|
| 1899 |
[structure.summary]: #structure.summary
|
| 1900 |
[support]: support.md#support
|
| 1901 |
[support.c.headers]: support.md#support.c.headers
|
| 1902 |
[support.c.headers.other]: support.md#support.c.headers.other
|
|
|
|
| 1903 |
[support.coroutine]: support.md#support.coroutine
|
| 1904 |
[support.dynamic]: support.md#support.dynamic
|
| 1905 |
[support.exception]: support.md#support.exception
|
| 1906 |
[support.initlist]: support.md#support.initlist
|
| 1907 |
[support.limits]: support.md#support.limits
|
| 1908 |
[support.rtti]: support.md#support.rtti
|
| 1909 |
[support.runtime]: support.md#support.runtime
|
| 1910 |
[support.srcloc]: support.md#support.srcloc
|
| 1911 |
-
[support.start.term]: support.md#support.start.term
|
| 1912 |
[support.types]: support.md#support.types
|
| 1913 |
[swappable.requirements]: #swappable.requirements
|
| 1914 |
[syserr]: diagnostics.md#syserr
|
| 1915 |
[syserr.errcode.overview]: diagnostics.md#syserr.errcode.overview
|
| 1916 |
[tab:cpp17.destructible]: #tab:cpp17.destructible
|
|
@@ -1920,11 +1958,13 @@ unspecified state.
|
|
| 1920 |
[temp.constr.decl]: temp.md#temp.constr.decl
|
| 1921 |
[temp.deduct.call]: temp.md#temp.deduct.call
|
| 1922 |
[template.bitset]: utilities.md#template.bitset
|
| 1923 |
[term.incomplete.type]: basic.md#term.incomplete.type
|
| 1924 |
[term.object.type]: basic.md#term.object.type
|
|
|
|
| 1925 |
[terminate.handler]: support.md#terminate.handler
|
|
|
|
| 1926 |
[thread]: thread.md#thread
|
| 1927 |
[time]: time.md#time
|
| 1928 |
[tuple]: utilities.md#tuple
|
| 1929 |
[type.descriptions]: #type.descriptions
|
| 1930 |
[type.descriptions.general]: #type.descriptions.general
|
|
@@ -1938,13 +1978,20 @@ unspecified state.
|
|
| 1938 |
[utility]: utilities.md#utility
|
| 1939 |
[utility.arg.requirements]: #utility.arg.requirements
|
| 1940 |
[utility.requirements]: #utility.requirements
|
| 1941 |
[utility.requirements.general]: #utility.requirements.general
|
| 1942 |
[value.error.codes]: #value.error.codes
|
|
|
|
|
|
|
|
|
|
| 1943 |
[zombie.names]: #zombie.names
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1944 |
|
| 1945 |
-
[^1]: See also ISO/IEC 9899:2018
|
| 1946 |
|
| 1947 |
[^2]: To save space, items that do not apply to a Clause are omitted.
|
| 1948 |
For example, if a Clause does not specify any requirements, there
|
| 1949 |
will be no “Requirements” subclause.
|
| 1950 |
|
|
@@ -2013,11 +2060,12 @@ unspecified state.
|
|
| 2013 |
|
| 2014 |
[^19]: This is the same as the C standard library.
|
| 2015 |
|
| 2016 |
[^20]: The only reliable way to declare an object or function signature
|
| 2017 |
from the C standard library is by including the header that declares
|
| 2018 |
-
it, notwithstanding the latitude granted in
|
|
|
|
| 2019 |
|
| 2020 |
[^21]: Any library code that instantiates other library templates must
|
| 2021 |
be prepared to work adequately with any user-supplied specialization
|
| 2022 |
that meets the minimum requirements of this document.
|
| 2023 |
|
|
@@ -2036,12 +2084,12 @@ unspecified state.
|
|
| 2036 |
|
| 2037 |
[^25]: A valid C++ program always calls the expected library non-member
|
| 2038 |
function. An implementation can also define additional non-member
|
| 2039 |
functions that would otherwise not be called by a valid C++ program.
|
| 2040 |
|
| 2041 |
-
[^26]: That is, the C library functions can all be treated as
|
| 2042 |
-
are marked `noexcept`. This allows implementations to make
|
| 2043 |
performance optimizations based on the absence of exceptions at
|
| 2044 |
runtime.
|
| 2045 |
|
| 2046 |
[^27]: The functions `qsort()` and `bsearch()` [[alg.c.library]] meet
|
| 2047 |
this condition.
|
|
|
|
| 1 |
## Library-wide requirements <a id="requirements">[[requirements]]</a>
|
| 2 |
|
| 3 |
### General <a id="requirements.general">[[requirements.general]]</a>
|
| 4 |
|
| 5 |
Subclause [[requirements]] specifies requirements that apply to the
|
| 6 |
+
entire C++ standard library. [[support]] through [[exec]] and [[depr]]
|
| 7 |
specify the requirements of individual entities within the library.
|
| 8 |
|
| 9 |
Requirements specified in terms of interactions between threads do not
|
| 10 |
apply to programs having only a single thread of execution.
|
| 11 |
|
|
|
|
| 37 |
|
| 38 |
It is unspecified whether names declared in a specific namespace are
|
| 39 |
declared directly in that namespace or in an inline namespace inside
|
| 40 |
that namespace.[^13]
|
| 41 |
|
| 42 |
+
Whenever an unqualified name other than `swap`, `make_error_code`,
|
| 43 |
+
`make_error_condition`, `from_stream`, or `submdspan_mapping` is used in
|
| 44 |
+
the specification of a declaration `D` in [[support]] through [[exec]]
|
| 45 |
+
or [[depr]], its meaning is established as-if by performing unqualified
|
| 46 |
+
name lookup [[basic.lookup.unqual]] in the context of `D`.
|
| 47 |
|
| 48 |
[*Note 1*: Argument-dependent lookup is not performed. — *end note*]
|
| 49 |
|
| 50 |
Similarly, the meaning of a *qualified-id* is established as-if by
|
| 51 |
performing qualified name lookup [[basic.lookup.qual]] in the context of
|
|
|
|
| 58 |
[*Note 2*: Operators in expressions [[over.match.oper]] are not so
|
| 59 |
constrained; see [[global.functions]]. — *end note*]
|
| 60 |
|
| 61 |
The meaning of the unqualified name `swap` is established in an overload
|
| 62 |
resolution context for swappable values [[swappable.requirements]]. The
|
| 63 |
+
meanings of the unqualified names `make_error_code`,
|
| 64 |
+
`make_error_condition`, `from_stream`, and `submdspan_mapping` are
|
| 65 |
+
established as-if by performing argument-dependent lookup
|
| 66 |
+
[[basic.lookup.argdep]].
|
| 67 |
|
| 68 |
#### Headers <a id="headers">[[headers]]</a>
|
| 69 |
|
| 70 |
Each element of the C++ standard library is declared or defined (as
|
| 71 |
appropriate) in a *header*.[^14]
|
|
|
|
| 91 |
std::vector<int> vi; // OK
|
| 92 |
```
|
| 93 |
|
| 94 |
— *end example*]
|
| 95 |
|
| 96 |
+
Except as noted in [[library]] through [[exec]] and [[depr]], the
|
| 97 |
contents of each header `cname` is the same as that of the corresponding
|
| 98 |
header `name.h` as specified in the C standard library [[intro.refs]].
|
| 99 |
In the C++ standard library, however, the declarations (except for names
|
| 100 |
which are defined as macros in C) are within namespace scope
|
| 101 |
[[basic.scope.namespace]] of the namespace `std`. It is unspecified
|
| 102 |
whether these names (including any overloads added in [[support]]
|
| 103 |
+
through [[exec]] and [[depr]]) are first declared within the global
|
| 104 |
namespace scope and are then injected into namespace `std` by explicit
|
| 105 |
*using-declaration*s [[namespace.udecl]].
|
| 106 |
|
| 107 |
Names which are defined as macros in C shall be defined as macros in the
|
| 108 |
C++ standard library, even if C grants license for implementation as
|
|
|
|
| 116 |
in the C++ standard library.[^16]
|
| 117 |
|
| 118 |
Identifiers that are keywords or operators in C++ shall not be defined
|
| 119 |
as macros in C++ standard library headers.[^17]
|
| 120 |
|
| 121 |
+
Subclause [[support.c.headers]] describes the effects of using the
|
| 122 |
+
`name.h` (C header) form in a C++ program.[^18]
|
| 123 |
|
| 124 |
+
ISO/IEC 9899:2018 (C), Annex K describes a large number of functions,
|
| 125 |
+
with associated types and macros, which “promote safer, more secure
|
| 126 |
programming” than many of the traditional C library functions. The names
|
| 127 |
of the functions have a suffix of `_s`; most of them provide the same
|
| 128 |
service as the C library function with the unsuffixed name, but
|
| 129 |
generally take an additional argument whose value is the size of the
|
| 130 |
result array. If any C++ header is included, it is
|
|
|
|
| 145 |
for C library facilities ([[headers.cpp.c]]). It additionally exports
|
| 146 |
declarations in the global namespace for the storage allocation and
|
| 147 |
deallocation functions that are provided by `<new>`.
|
| 148 |
|
| 149 |
The named module `std.compat` exports the same declarations as the named
|
| 150 |
+
module `std`, and additionally exports
|
| 151 |
+
|
| 152 |
+
- declarations in the global namespace corresponding to the declarations
|
| 153 |
+
in namespace `std` that are provided by the C++ headers for C library
|
| 154 |
+
facilities ([[headers.cpp.c]]), except the explicitly excluded
|
| 155 |
+
declarations described in [[support.c.headers.other]] and
|
| 156 |
+
- declarations provided by the headers `<stdbit.h>` and `<stdckdint.h>`.
|
| 157 |
|
| 158 |
It is unspecified to which module a declaration in the standard library
|
| 159 |
is attached.
|
| 160 |
|
| 161 |
+
[*Note 1*: Conforming implementations ensure that mixing `#include` and
|
| 162 |
+
`import` does not result in conflicting attachments
|
| 163 |
[[basic.link]]. — *end note*]
|
| 164 |
|
| 165 |
*Recommended practice:* Implementations should ensure such attachments
|
| 166 |
do not preclude further evolution or decomposition of the standard
|
| 167 |
library modules.
|
|
|
|
| 190 |
[[headers.cpp.fs]].
|
| 191 |
|
| 192 |
**Table: C++ headers for freestanding implementations** <a id="headers.cpp.fs">[headers.cpp.fs]</a>
|
| 193 |
|
| 194 |
| Subclause | | Header |
|
| 195 |
+
| --------------------- | ----------------------------------------------- | ------------------------------------ |
|
| 196 |
| [[support.types]] | Common definitions | `<cstddef>` |
|
| 197 |
+
| [[cstdlib.syn]] | C standard library | `<cstdlib>` |
|
| 198 |
+
| [[support.limits]] | Implementation properties | `<cfloat>`, `<climits>`, `<limits>`, |
|
| 199 |
+
| | | `<version>` |
|
| 200 |
| [[cstdint.syn]] | Integer types | `<cstdint>` |
|
|
|
|
| 201 |
| [[support.dynamic]] | Dynamic memory management | `<new>` |
|
| 202 |
| [[support.rtti]] | Type identification | `<typeinfo>` |
|
| 203 |
| [[support.srcloc]] | Source location | `<source_location>` |
|
| 204 |
| [[support.exception]] | Exception handling | `<exception>` |
|
| 205 |
| [[support.initlist]] | Initializer lists | `<initializer_list>` |
|
| 206 |
| [[cmp]] | Comparisons | `<compare>` |
|
| 207 |
+
| [[support.contract]] | Contract-violation handling | `<contracts>` |
|
| 208 |
| [[support.coroutine]] | Coroutines support | `<coroutine>` |
|
| 209 |
| [[support.runtime]] | Other runtime support | `<cstdarg>` |
|
| 210 |
| [[concepts]] | Concepts library | `<concepts>` |
|
| 211 |
+
| [[errno]] | Error numbers | `<cerrno>` |
|
| 212 |
+
| [[syserr]] | System error support | `<system_error>` |
|
| 213 |
+
| [[debugging]] | Debugging | `<debugging>` |
|
| 214 |
+
| [[memory]] | Memory | `<memory>` |
|
| 215 |
| [[type.traits]] | Type traits | `<type_traits>` |
|
| 216 |
+
| [[ratio]] | Compile-time rational arithmetic | `<ratio>` |
|
|
|
|
| 217 |
| [[utility]] | Utility components | `<utility>` |
|
| 218 |
| [[tuple]] | Tuples | `<tuple>` |
|
| 219 |
+
| [[optional]] | Optional objects | `<optional>` |
|
| 220 |
+
| [[variant]] | Variants | `<variant>` |
|
| 221 |
+
| [[expected]] | Expected objects | `<expected>` |
|
| 222 |
| [[function.objects]] | Function objects | `<functional>` |
|
| 223 |
+
| [[bit]] | Bit manipulation | `<bit>` |
|
| 224 |
+
| [[stdbit.h.syn]] | C-compatible bit manipulation | `<stdbit.h>` |
|
| 225 |
+
| [[array]] | Class template `array` | `<array>` |
|
| 226 |
+
| [[inplace.vector]] | Class template `inplace_vector` | `<inplace_vector>` |
|
| 227 |
+
| [[views.contiguous]] | Contiguous access | `<span>` |
|
| 228 |
+
| [[views.multidim]] | Multidimensional access | `<mdspan>` |
|
| 229 |
| [[iterators]] | Iterators library | `<iterator>` |
|
| 230 |
| [[ranges]] | Ranges library | `<ranges>` |
|
| 231 |
+
| [[algorithms]] | Algorithms library | `<algorithm>`, `<numeric>` |
|
| 232 |
+
| [[execpol]] | Execution policies | `<execution>` |
|
| 233 |
+
| [[string.view]] | String view classes | `<string_view>` |
|
| 234 |
+
| [[string.classes]] | String classes | `<string>` |
|
| 235 |
+
| [[c.strings]] | Null-terminated sequence utilities | `<cstring>`, `<cwchar>` |
|
| 236 |
+
| [[charconv]] | Primitive numeric conversions | `<charconv>` |
|
| 237 |
+
| [[rand]] | Random number generation | `<random>` |
|
| 238 |
+
| [[c.math]] | Mathematical functions for floating-point types | `<cmath>` |
|
| 239 |
+
| [[atomics]] | Atomics | `<atomic>` |
|
| 240 |
|
| 241 |
|
| 242 |
For each of the headers listed in [[headers.cpp.fs]], a freestanding
|
| 243 |
implementation provides at least the freestanding items
|
| 244 |
[[freestanding.item]] declared in the header.
|
| 245 |
|
| 246 |
+
The *hosted library facilities* are the set of facilities described in
|
| 247 |
+
this document that are required for hosted implementations, but not
|
| 248 |
+
required for freestanding implementations. A freestanding implementation
|
| 249 |
+
provides a (possibly empty) implementation-defined subset of the hosted
|
| 250 |
+
library facilities. Unless otherwise specified, the requirements on each
|
| 251 |
+
declaration, entity, and macro provided in this way are the same as the
|
| 252 |
+
corresponding requirements for a hosted implementation, except that not
|
| 253 |
+
all of the members of the namespaces are required to be present.
|
| 254 |
+
|
| 255 |
+
A freestanding implementation provides deleted definitions
|
| 256 |
+
[[dcl.fct.def.delete]] for a (possibly empty) implementation-defined
|
| 257 |
+
subset of the namespace-scope functions and function templates from the
|
| 258 |
+
hosted library facilities.
|
| 259 |
+
|
| 260 |
+
[*Note 1*: An implementation can provide a deleted definition so that
|
| 261 |
+
the result of overload resolution does not silently change when
|
| 262 |
+
migrating a program from a freestanding implementation to a hosted
|
| 263 |
+
implementation. — *end note*]
|
| 264 |
+
|
| 265 |
### Using the library <a id="using">[[using]]</a>
|
| 266 |
|
| 267 |
#### Overview <a id="using.overview">[[using.overview]]</a>
|
| 268 |
|
| 269 |
Subclause [[using]] describes how a C++ program gains access to the
|
|
|
|
| 400 |
|
| 401 |
**Table: Cpp17Destructible requirements** <a id="cpp17.destructible">[cpp17.destructible]</a>
|
| 402 |
|
| 403 |
| Expression | Post-condition |
|
| 404 |
| ---------- | --------------------------------------------------------------------- |
|
| 405 |
+
| `a.~T()` | All resources owned by `a` are reclaimed, no exception is propagated. |
|
| 406 |
| *[spans 2 columns]* *Array types and non-object types are not Cpp17Destructible.* |
|
| 407 |
|
| 408 |
|
| 409 |
#### Swappable requirements <a id="swappable.requirements">[[swappable.requirements]]</a>
|
| 410 |
|
| 411 |
This subclause provides definitions for swappable types and expressions.
|
| 412 |
In these definitions, let `t` denote an expression of type `T`, and let
|
| 413 |
`u` denote an expression of type `U`.
|
| 414 |
|
| 415 |
+
An object `t` is *swappable with* an object `u` if and only if
|
| 416 |
|
| 417 |
- the expressions `swap(t, u)` and `swap(u, t)` are valid when evaluated
|
| 418 |
in the context described below, and
|
| 419 |
- these expressions have the following effects:
|
| 420 |
- the object referred to by `t` has the value originally held by `u`
|
|
|
|
| 440 |
appropriate evaluation context. — *end note*]
|
| 441 |
|
| 442 |
An rvalue or lvalue `t` is *swappable* if and only if `t` is swappable
|
| 443 |
with any rvalue or lvalue, respectively, of type `T`.
|
| 444 |
|
| 445 |
+
A type `X` meets the requirements if lvalues of type `X` are swappable.
|
|
|
|
| 446 |
|
| 447 |
A type `X` meeting any of the iterator requirements
|
| 448 |
+
[[iterator.requirements]] meets the requirements if, for any
|
| 449 |
+
dereferenceable object `x` of type `X`, `*x` is swappable.
|
| 450 |
|
| 451 |
[*Example 1*:
|
| 452 |
|
| 453 |
User code can ensure that the evaluation of `swap` calls is performed in
|
| 454 |
an appropriate context under the various conditions as follows:
|
|
|
|
| 498 |
— *end example*]
|
| 499 |
|
| 500 |
#### *Cpp17NullablePointer* requirements <a id="nullablepointer.requirements">[[nullablepointer.requirements]]</a>
|
| 501 |
|
| 502 |
A *Cpp17NullablePointer* type is a pointer-like type that supports null
|
| 503 |
+
values. A type `P` meets the *Cpp17NullablePointer* requirements if
|
| 504 |
|
| 505 |
- `P` meets the *Cpp17EqualityComparable*, *Cpp17DefaultConstructible*,
|
| 506 |
*Cpp17CopyConstructible*, *Cpp17CopyAssignable*, *Cpp17Swappable*, and
|
| 507 |
*Cpp17Destructible* requirements,
|
| 508 |
- the expressions shown in [[cpp17.nullablepointer]] are valid and have
|
| 509 |
the indicated semantics, and
|
| 510 |
- `P` meets all the other requirements of this subclause.
|
| 511 |
|
| 512 |
A value-initialized object of type `P` produces the null value of the
|
| 513 |
type. The null value shall be equivalent only to itself. A
|
| 514 |
+
default-initialized object of type `P` may have an indeterminate or
|
| 515 |
+
erroneous value.
|
| 516 |
|
| 517 |
[*Note 1*: Operations involving indeterminate values can cause
|
| 518 |
+
undefined behavior, and operations involving erroneous values can cause
|
| 519 |
+
erroneous behavior [[basic.indet]]. — *end note*]
|
| 520 |
|
| 521 |
An object `p` of type `P` can be contextually converted to `bool`
|
| 522 |
[[conv]]. The effect shall be as if `p != nullptr` had been evaluated in
|
| 523 |
place of `p`.
|
| 524 |
|
|
|
|
| 545 |
| `np != a` | | |
|
| 546 |
|
| 547 |
|
| 548 |
#### *Cpp17Hash* requirements <a id="hash.requirements">[[hash.requirements]]</a>
|
| 549 |
|
| 550 |
+
A type `H` meets the requirements if
|
| 551 |
|
| 552 |
- it is a function object type [[function.objects]],
|
| 553 |
- it meets the *Cpp17CopyConstructible* ([[cpp17.copyconstructible]])
|
| 554 |
and *Cpp17Destructible* ([[cpp17.destructible]]) requirements, and
|
| 555 |
- the expressions shown in [[cpp17.hash]] are valid and have the
|
|
|
|
| 572 |
which are class-type objects that encapsulate the information about an
|
| 573 |
allocation model. This information includes the knowledge of pointer
|
| 574 |
types, the type of their difference, the type of the size of objects in
|
| 575 |
this allocation model, as well as the memory allocation and deallocation
|
| 576 |
primitives for it. All of the string types [[strings]], containers
|
| 577 |
+
[[containers]] (except `array` and `inplace_vector`), string buffers and
|
| 578 |
+
string streams [[input.output]], and `match_results` [[re]] are
|
| 579 |
+
parameterized in terms of allocators.
|
| 580 |
|
| 581 |
+
In [[allocator.requirements]],
|
| 582 |
|
| 583 |
- `T`, `U`, `C` denote any cv-unqualified object type
|
| 584 |
[[term.object.type]],
|
| 585 |
- `X` denotes an allocator class for type `T`,
|
| 586 |
- `Y` denotes the corresponding allocator class for type `U`,
|
|
|
|
| 676 |
between any two pointers in the allocation model.
|
| 677 |
|
| 678 |
*Remarks:* Default: `pointer_traits<XX::pointer>::difference_type`
|
| 679 |
|
| 680 |
``` cpp
|
| 681 |
+
typename X::rebind<U>::other
|
| 682 |
```
|
| 683 |
|
| 684 |
*Result:* `Y`
|
| 685 |
|
| 686 |
*Ensures:* For all `U` (including `T`), `YY::rebind_alloc<T>` is `X`.
|
|
|
|
| 907 |
*Ensures:* `u` is equal to the prior value of `X(b)`.
|
| 908 |
|
| 909 |
*Throws:* Nothing.
|
| 910 |
|
| 911 |
``` cpp
|
| 912 |
+
a.construct(c, args...)
|
| 913 |
```
|
| 914 |
|
| 915 |
*Result:* (not used)
|
| 916 |
|
| 917 |
*Effects:* Constructs an object of type `C` at `c`.
|
|
|
|
| 1076 |
};
|
| 1077 |
```
|
| 1078 |
|
| 1079 |
— *end example*]
|
| 1080 |
|
| 1081 |
+
The following exposition-only concept defines the minimal requirements
|
| 1082 |
+
on an Allocator type.
|
| 1083 |
+
|
| 1084 |
+
``` cpp
|
| 1085 |
+
namespace std {
|
| 1086 |
+
template<class Alloc>
|
| 1087 |
+
concept simple-allocator =
|
| 1088 |
+
requires(Alloc alloc, size_t n) {
|
| 1089 |
+
{ *alloc.allocate(n) } -> same_as<typename Alloc::value_type&>;
|
| 1090 |
+
{ alloc.deallocate(alloc.allocate(n), n) };
|
| 1091 |
+
} &&
|
| 1092 |
+
copy_constructible<Alloc> &&
|
| 1093 |
+
equality_comparable<Alloc>;
|
| 1094 |
+
}
|
| 1095 |
+
```
|
| 1096 |
+
|
| 1097 |
+
A type `Alloc` models `simple-allocator` if it meets the requirements of
|
| 1098 |
+
[[allocator.requirements.general]].
|
| 1099 |
+
|
| 1100 |
##### Allocator completeness requirements <a id="allocator.requirements.completeness">[[allocator.requirements.completeness]]</a>
|
| 1101 |
|
| 1102 |
If `X` is an allocator class for type `T`, `X` additionally meets the
|
| 1103 |
allocator completeness requirements if, whether or not `T` is a complete
|
| 1104 |
type:
|
|
|
|
| 1128 |
if it adds declarations or definitions to namespace `std` or to a
|
| 1129 |
namespace within namespace `std`.
|
| 1130 |
|
| 1131 |
Unless explicitly prohibited, a program may add a template
|
| 1132 |
specialization for any standard library class template to namespace
|
| 1133 |
+
`std` provided that
|
| 1134 |
+
|
| 1135 |
+
- the added declaration depends on at least one program-defined type,
|
| 1136 |
+
and
|
| 1137 |
+
- the specialization meets the standard library requirements for the
|
| 1138 |
+
original template.[^21]
|
| 1139 |
|
| 1140 |
The behavior of a C++ program is undefined if it declares an explicit or
|
| 1141 |
partial specialization of any standard library variable template, except
|
| 1142 |
where explicitly permitted by the specification of that variable
|
| 1143 |
template.
|
|
|
|
| 1155 |
- an explicit or partial specialization of any member class template of
|
| 1156 |
a standard library class or class template, or
|
| 1157 |
- a deduction guide for any standard library class template.
|
| 1158 |
|
| 1159 |
A program may explicitly instantiate a class template defined in the
|
| 1160 |
+
standard library only if the declaration
|
| 1161 |
+
|
| 1162 |
+
- depends on the name of at least one program-defined type, and
|
| 1163 |
+
- the instantiation meets the standard library requirements for the
|
| 1164 |
+
original template.
|
| 1165 |
|
| 1166 |
Let `F` denote a standard library function [[global.functions]], a
|
| 1167 |
standard library static member function, or an instantiation of a
|
| 1168 |
standard library function template. Unless `F` is designated an
|
| 1169 |
*addressable function*, the behavior of a C++ program is unspecified
|
|
|
|
| 1179 |
ill-formed) if it attempts to form a reference to `F` or if it attempts
|
| 1180 |
to form a pointer-to-member designating either a standard library
|
| 1181 |
non-static member function [[member.functions]] or an instantiation of a
|
| 1182 |
standard library member function template.
|
| 1183 |
|
| 1184 |
+
Let `F` denote a standard library function or function template. Unless
|
| 1185 |
+
`F` is designated an addressable function, it is unspecified if or how a
|
| 1186 |
+
reflection value designating the associated entity can be formed.
|
| 1187 |
+
|
| 1188 |
+
[*Note 3*: For example, it is possible that `std::meta::members_of`
|
| 1189 |
+
will not return reflections of standard library functions that an
|
| 1190 |
+
implementation handles through an extra-linguistic
|
| 1191 |
+
mechanism. — *end note*]
|
| 1192 |
+
|
| 1193 |
+
Let `C` denote a standard library class or class template
|
| 1194 |
+
specialization. It is unspecified if or how a reflection value can be
|
| 1195 |
+
formed to any private member of `C`, or what the names of such members
|
| 1196 |
+
may be.
|
| 1197 |
+
|
| 1198 |
A translation unit shall not declare namespace `std` to be an inline
|
| 1199 |
namespace [[namespace.def]].
|
| 1200 |
|
| 1201 |
##### Namespace `posix` <a id="namespace.posix">[[namespace.posix]]</a>
|
| 1202 |
|
| 1203 |
The behavior of a C++ program is undefined if it adds declarations or
|
| 1204 |
definitions to namespace `posix` or to a namespace within namespace
|
| 1205 |
`posix` unless otherwise specified. The namespace `posix` is reserved
|
| 1206 |
+
for use by \IsoPosixUndated and other POSIX standards.
|
| 1207 |
|
| 1208 |
##### Namespaces for future standardization <a id="namespace.future">[[namespace.future]]</a>
|
| 1209 |
|
| 1210 |
Top-level namespaces whose *namespace-name* consists of `std` followed
|
| 1211 |
by one or more *digit*s [[lex.name]] are reserved for future
|
|
|
|
| 1229 |
reserved, other than as explicitly allowed by [[library]], its behavior
|
| 1230 |
is undefined.
|
| 1231 |
|
| 1232 |
##### Zombie names <a id="zombie.names">[[zombie.names]]</a>
|
| 1233 |
|
| 1234 |
+
In namespace `std`, the names shown in [[zombie.names.std]] are reserved
|
| 1235 |
+
for previous standardization:
|
| 1236 |
|
| 1237 |
+
The names shown in [[zombie.names.objmacro]] are reserved as members for
|
| 1238 |
+
previous standardization, and may not be used as a name for object-like
|
| 1239 |
+
macros in portable code:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1240 |
|
| 1241 |
+
The names shown in [[zombie.names.fnmacro]] are reserved as member
|
| 1242 |
+
functions for previous standardization, and may not be used as a name
|
| 1243 |
+
for function-like macros in portable code:
|
| 1244 |
|
| 1245 |
+
The header names shown in [[zombie.names.header]] are reserved for
|
| 1246 |
+
previous standardization:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1247 |
|
| 1248 |
##### Macro names <a id="macro.names">[[macro.names]]</a>
|
| 1249 |
|
| 1250 |
A translation unit that includes a standard library header shall not
|
| 1251 |
`#define` or `#undef` names declared in any standard library header.
|
| 1252 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1253 |
##### External linkage <a id="extern.names">[[extern.names]]</a>
|
| 1254 |
|
| 1255 |
Each name declared as an object with external linkage in a header is
|
| 1256 |
reserved to the implementation to designate that library object with
|
| 1257 |
external linkage, [^22]
|
|
|
|
| 1299 |
standard library may be overridden in a derived class defined in the
|
| 1300 |
program [[class.virtual]].
|
| 1301 |
|
| 1302 |
#### Replacement functions <a id="replacement.functions">[[replacement.functions]]</a>
|
| 1303 |
|
| 1304 |
+
If a function defined in [[support]] through [[exec]] and [[depr]] is
|
| 1305 |
+
specified as replaceable [[term.replaceable.function]], the description
|
| 1306 |
+
of function semantics apply to both the default version defined by the
|
| 1307 |
+
C++ standard library and the replacement function defined by the
|
| 1308 |
+
program.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1309 |
|
| 1310 |
#### Handler functions <a id="handler.functions">[[handler.functions]]</a>
|
| 1311 |
|
| 1312 |
The C++ standard library provides a default version of the following
|
| 1313 |
handler function [[support]]:
|
|
|
|
| 1328 |
calling the following functions:
|
| 1329 |
|
| 1330 |
- `get_new_handler`
|
| 1331 |
- `get_terminate`
|
| 1332 |
|
| 1333 |
+
Calling the `set_*` and `get_*` functions shall not incur a data race
|
| 1334 |
+
[[intro.races]]. A call to any of the `set_*` functions synchronizes
|
| 1335 |
+
with subsequent calls to the same `set_*` function and to the
|
| 1336 |
+
corresponding `get_*` function.
|
| 1337 |
|
| 1338 |
#### Other functions <a id="res.on.functions">[[res.on.functions]]</a>
|
| 1339 |
|
| 1340 |
In certain cases (replacement functions, handler functions, operations
|
| 1341 |
on types used to instantiate standard library template components), the
|
|
|
|
| 1343 |
these components do not meet their requirements, this document places no
|
| 1344 |
requirements on the implementation.
|
| 1345 |
|
| 1346 |
In particular, the behavior is undefined in the following cases:
|
| 1347 |
|
| 1348 |
+
- For replacement functions [[replacement.functions]], if the installed
|
| 1349 |
+
replacement function does not implement the semantics of the
|
| 1350 |
+
applicable *Required behavior:* paragraph.
|
| 1351 |
- For handler functions [[new.handler]], [[terminate.handler]], if the
|
| 1352 |
installed handler function does not implement the semantics of the
|
| 1353 |
applicable *Required behavior:* paragraph.
|
| 1354 |
- For types used as template arguments when instantiating a template
|
| 1355 |
component, if the operations on the type do not implement the
|
|
|
|
| 1377 |
address computations and accesses to objects (that would be valid if
|
| 1378 |
the pointer did point to the first element of such an array) are in
|
| 1379 |
fact valid.
|
| 1380 |
- If a function argument is bound to an rvalue reference parameter, the
|
| 1381 |
implementation may assume that this parameter is a unique reference to
|
| 1382 |
+
this argument, except that the argument passed to a move assignment
|
| 1383 |
operator may be a reference to `*this` [[lib.types.movedfrom]].
|
| 1384 |
\[*Note 1*: If the type of a parameter is a forwarding reference
|
| 1385 |
[[temp.deduct.call]] that is deduced to an lvalue reference type, then
|
| 1386 |
the argument is not bound to an rvalue reference. — *end note*]
|
| 1387 |
\[*Note 2*: If a program casts an lvalue to an xvalue while passing
|
|
|
|
| 1430 |
#### Overview <a id="conforming.overview">[[conforming.overview]]</a>
|
| 1431 |
|
| 1432 |
Subclause [[conforming]] describes the constraints upon, and latitude
|
| 1433 |
of, implementations of the C++ standard library.
|
| 1434 |
|
| 1435 |
+
An implementation’s use of
|
| 1436 |
+
|
| 1437 |
+
- headers is discussed in [[res.on.headers]],
|
| 1438 |
+
- macros in [[res.on.macro.definitions]],
|
| 1439 |
+
- non-member functions in [[global.functions]],
|
| 1440 |
+
- member functions in [[member.functions]],
|
| 1441 |
+
- data race avoidance in [[res.on.data.races]],
|
| 1442 |
+
- access specifiers in [[protection.within.classes]],
|
| 1443 |
+
- class derivation in [[derivation]],
|
| 1444 |
+
- exceptions in [[res.on.exception.handling]], and
|
| 1445 |
+
- contract assertions in [[res.contract.assertions]].
|
| 1446 |
|
| 1447 |
#### Headers <a id="res.on.headers">[[res.on.headers]]</a>
|
| 1448 |
|
| 1449 |
A C++ header may include other C++ headers. A C++ header shall provide
|
| 1450 |
the declarations and definitions that appear in its synopsis. A C++
|
|
|
|
| 1474 |
|
| 1475 |
It is unspecified whether any non-member functions in the C++ standard
|
| 1476 |
library are defined as inline [[dcl.inline]].
|
| 1477 |
|
| 1478 |
A call to a non-member function signature described in [[support]]
|
| 1479 |
+
through [[exec]] and [[depr]] shall behave as if the implementation
|
| 1480 |
declared no additional non-member function signatures.[^25]
|
| 1481 |
|
| 1482 |
An implementation shall not declare a non-member function signature with
|
| 1483 |
additional default arguments.
|
| 1484 |
|
|
|
|
| 1526 |
Whenever this document specifies a friend declaration of a function or
|
| 1527 |
function template within a class or class template definition, that
|
| 1528 |
declaration shall be the only declaration of that function or function
|
| 1529 |
template provided by an implementation.
|
| 1530 |
|
| 1531 |
+
[*Note 1*: In particular, a conforming implementation does not provide
|
| 1532 |
+
any additional declarations of that function or function template at
|
| 1533 |
namespace scope. — *end note*]
|
| 1534 |
|
| 1535 |
[*Note 2*: Such a friend function or function template declaration is
|
| 1536 |
known as a hidden friend, as it is visible neither to ordinary
|
| 1537 |
unqualified lookup [[basic.lookup.unqual]] nor to qualified lookup
|
|
|
|
| 1541 |
|
| 1542 |
This document explicitly requires that certain standard library
|
| 1543 |
functions are `constexpr` [[dcl.constexpr]]. An implementation shall not
|
| 1544 |
declare any standard library function signature as `constexpr` except
|
| 1545 |
for those where it is explicitly required. Within any header that
|
| 1546 |
+
provides any non-defining declarations of constexpr functions an
|
| 1547 |
+
implementation shall provide corresponding definitions.
|
| 1548 |
|
| 1549 |
#### Requirements for stable algorithms <a id="algorithm.stable">[[algorithm.stable]]</a>
|
| 1550 |
|
| 1551 |
When the requirements for an algorithm state that it is “stable” without
|
| 1552 |
further elaboration, it means:
|
|
|
|
| 1611 |
effects that are visible [[intro.multithread]] to users.
|
| 1612 |
|
| 1613 |
[*Note 3*: This allows implementations to parallelize operations if
|
| 1614 |
there are no visible side effects. — *end note*]
|
| 1615 |
|
| 1616 |
+
#### Properties of library classes <a id="library.class.props">[[library.class.props]]</a>
|
| 1617 |
+
|
| 1618 |
+
Unless explicitly stated otherwise, it is unspecified whether any class
|
| 1619 |
+
described in [[support]] through [[exec]] and [[depr]] is a trivially
|
| 1620 |
+
copyable class, a standard-layout class, or an implicit-lifetime class
|
| 1621 |
+
[[class.prop]].
|
| 1622 |
+
|
| 1623 |
+
Unless explicitly stated otherwise, it is unspecified whether any class
|
| 1624 |
+
for which trivial relocation (i.e., the effects of `trivially_relocate`
|
| 1625 |
+
[[obj.lifetime]]) would be semantically equivalent to move-construction
|
| 1626 |
+
of the destination object followed by destruction of the source object
|
| 1627 |
+
is a trivially relocatable class [[class.prop]].
|
| 1628 |
+
|
| 1629 |
+
Unless explicitly stated otherwise, it is unspecified whether a class
|
| 1630 |
+
`C` is a replaceable class [[class.prop]] if assigning an xvalue `a` of
|
| 1631 |
+
type `C` to an object `b` of type `C` is semantically equivalent to
|
| 1632 |
+
destroying `b` and then constructing from `a` in `b`’s place.
|
| 1633 |
+
|
| 1634 |
#### Protection within classes <a id="protection.within.classes">[[protection.within.classes]]</a>
|
| 1635 |
|
| 1636 |
It is unspecified whether any function signature or class described in
|
| 1637 |
+
[[support]] through [[exec]] and [[depr]] is a friend of another class
|
| 1638 |
in the C++ standard library.
|
| 1639 |
|
| 1640 |
#### Derived classes <a id="derivation">[[derivation]]</a>
|
| 1641 |
|
| 1642 |
An implementation may derive any class in the C++ standard library from
|
|
|
|
| 1664 |
#### Restrictions on exception handling <a id="res.on.exception.handling">[[res.on.exception.handling]]</a>
|
| 1665 |
|
| 1666 |
Any of the functions defined in the C++ standard library can report a
|
| 1667 |
failure by throwing an exception of a type described in its *Throws:*
|
| 1668 |
paragraph, or of a type derived from a type named in the *Throws:*
|
| 1669 |
+
paragraph that would be caught by a *handler* [[except.handle]] for the
|
| 1670 |
+
base type.
|
| 1671 |
|
| 1672 |
Functions from the C standard library shall not throw exceptions [^26]
|
| 1673 |
|
| 1674 |
except when such a function calls a program-supplied function that
|
| 1675 |
throws an exception.[^27]
|
| 1676 |
|
| 1677 |
Destructor operations defined in the C++ standard library shall not
|
| 1678 |
throw exceptions. Every destructor in the C++ standard library shall
|
| 1679 |
+
behave as if it had a non-throwing exception specification
|
| 1680 |
+
[[except.spec]].
|
| 1681 |
|
| 1682 |
Functions defined in the C++ standard library that do not have a
|
| 1683 |
*Throws:* paragraph but do have a potentially-throwing exception
|
| 1684 |
specification may throw *implementation-defined* exceptions.[^28]
|
| 1685 |
|
|
|
|
| 1688 |
[[bad.alloc]], [[support.exception]], [[std.exceptions]].
|
| 1689 |
|
| 1690 |
An implementation may strengthen the exception specification for a
|
| 1691 |
non-virtual function by adding a non-throwing exception specification.
|
| 1692 |
|
| 1693 |
+
#### Contract assertions <a id="res.contract.assertions">[[res.contract.assertions]]</a>
|
| 1694 |
+
|
| 1695 |
+
Unless specified otherwise, an implementation may check the specified
|
| 1696 |
+
preconditions and postconditions of a function in the C++ standard
|
| 1697 |
+
library using contract assertions
|
| 1698 |
+
[[basic.contract]], [[structure.specifications]].
|
| 1699 |
+
|
| 1700 |
#### Value of error codes <a id="value.error.codes">[[value.error.codes]]</a>
|
| 1701 |
|
| 1702 |
Certain functions in the C++ standard library report errors via a
|
| 1703 |
+
`error_code` [[syserr.errcode.overview]] object. That object’s
|
| 1704 |
+
`category()` member shall return `system_category()` for errors
|
| 1705 |
originating from the operating system, or a reference to an
|
| 1706 |
*implementation-defined* `error_category` object for errors originating
|
| 1707 |
elsewhere. The implementation shall define the possible values of
|
| 1708 |
`value()` for each of these error categories.
|
| 1709 |
|
|
|
|
| 1719 |
#### Moved-from state of library types <a id="lib.types.movedfrom">[[lib.types.movedfrom]]</a>
|
| 1720 |
|
| 1721 |
Objects of types defined in the C++ standard library may be moved from
|
| 1722 |
[[class.copy.ctor]]. Move operations may be explicitly specified or
|
| 1723 |
implicitly generated. Unless otherwise specified, such moved-from
|
| 1724 |
+
objects shall be placed in a valid but unspecified state
|
| 1725 |
+
[[defns.valid]].
|
| 1726 |
|
| 1727 |
An object of a type defined in the C++ standard library may be
|
| 1728 |
move-assigned [[class.copy.assign]] to itself. Unless otherwise
|
| 1729 |
specified, such an assignment places the object in a valid but
|
| 1730 |
unspecified state.
|
| 1731 |
|
| 1732 |
<!-- Link reference definitions -->
|
| 1733 |
[alg.c.library]: algorithms.md#alg.c.library
|
| 1734 |
+
[alg.func.obj]: #alg.func.obj
|
| 1735 |
[alg.sorting]: algorithms.md#alg.sorting
|
| 1736 |
[algorithm.stable]: #algorithm.stable
|
| 1737 |
[algorithms]: algorithms.md#algorithms
|
| 1738 |
[algorithms.requirements]: algorithms.md#algorithms.requirements
|
| 1739 |
[alloc.errors]: support.md#alloc.errors
|
| 1740 |
[allocator.requirements]: #allocator.requirements
|
| 1741 |
[allocator.requirements.completeness]: #allocator.requirements.completeness
|
| 1742 |
[allocator.requirements.general]: #allocator.requirements.general
|
| 1743 |
[allocator.traits]: mem.md#allocator.traits
|
| 1744 |
[alt.headers]: #alt.headers
|
| 1745 |
+
[array]: containers.md#array
|
| 1746 |
[array.creation]: containers.md#array.creation
|
| 1747 |
[atomics]: thread.md#atomics
|
| 1748 |
[bad.alloc]: support.md#bad.alloc
|
| 1749 |
+
[basic.contract]: basic.md#basic.contract
|
| 1750 |
+
[basic.contract.eval]: basic.md#basic.contract.eval
|
| 1751 |
[basic.def.odr]: basic.md#basic.def.odr
|
| 1752 |
[basic.fundamental]: basic.md#basic.fundamental
|
| 1753 |
+
[basic.indet]: basic.md#basic.indet
|
| 1754 |
[basic.life]: basic.md#basic.life
|
| 1755 |
[basic.link]: basic.md#basic.link
|
| 1756 |
[basic.lookup.argdep]: basic.md#basic.lookup.argdep
|
| 1757 |
[basic.lookup.qual]: basic.md#basic.lookup.qual
|
| 1758 |
[basic.lookup.unqual]: basic.md#basic.lookup.unqual
|
| 1759 |
[basic.scope.namespace]: basic.md#basic.scope.namespace
|
|
|
|
| 1760 |
[basic.stc.dynamic]: basic.md#basic.stc.dynamic
|
| 1761 |
[bit]: utilities.md#bit
|
| 1762 |
[bitmask.types]: #bitmask.types
|
| 1763 |
[byte.strings]: #byte.strings
|
| 1764 |
[c.annex.k.names]: #c.annex.k.names
|
| 1765 |
+
[c.math]: numerics.md#c.math
|
| 1766 |
+
[c.strings]: strings.md#c.strings
|
| 1767 |
[cassert.syn]: diagnostics.md#cassert.syn
|
| 1768 |
[cerrno.syn]: diagnostics.md#cerrno.syn
|
| 1769 |
[character.seq]: #character.seq
|
| 1770 |
[character.seq.general]: #character.seq.general
|
| 1771 |
+
[charconv]: text.md#charconv
|
| 1772 |
[class.copy.assign]: class.md#class.copy.assign
|
| 1773 |
[class.copy.ctor]: class.md#class.copy.ctor
|
| 1774 |
[class.dtor]: class.md#class.dtor
|
| 1775 |
[class.mem]: class.md#class.mem
|
| 1776 |
+
[class.prop]: class.md#class.prop
|
| 1777 |
[class.virtual]: class.md#class.virtual
|
| 1778 |
+
[clocale.syn]: text.md#clocale.syn
|
| 1779 |
[cmp]: support.md#cmp
|
| 1780 |
[compliance]: #compliance
|
| 1781 |
[concept.destructible]: concepts.md#concept.destructible
|
| 1782 |
[concept.invocable]: concepts.md#concept.invocable
|
| 1783 |
[concept.totallyordered]: concepts.md#concept.totallyordered
|
|
|
|
| 1795 |
[conv]: expr.md#conv
|
| 1796 |
[conv.func]: expr.md#conv.func
|
| 1797 |
[conventions]: #conventions
|
| 1798 |
[conventions.general]: #conventions.general
|
| 1799 |
[cpp.include]: cpp.md#cpp.include
|
|
|
|
| 1800 |
[cpp17.copyassignable]: #cpp17.copyassignable
|
| 1801 |
[cpp17.copyconstructible]: #cpp17.copyconstructible
|
| 1802 |
[cpp17.destructible]: #cpp17.destructible
|
| 1803 |
[cpp17.hash]: #cpp17.hash
|
| 1804 |
[cpp17.moveassignable]: #cpp17.moveassignable
|
| 1805 |
[cpp17.nullablepointer]: #cpp17.nullablepointer
|
| 1806 |
[cstdarg.syn]: support.md#cstdarg.syn
|
| 1807 |
[cstddef.syn]: support.md#cstddef.syn
|
| 1808 |
[cstdint.syn]: support.md#cstdint.syn
|
| 1809 |
+
[cstdlib.syn]: support.md#cstdlib.syn
|
| 1810 |
[customization.point.object]: #customization.point.object
|
| 1811 |
[dcl.array]: dcl.md#dcl.array
|
|
|
|
| 1812 |
[dcl.constexpr]: dcl.md#dcl.constexpr
|
| 1813 |
+
[dcl.contract.func]: dcl.md#dcl.contract.func
|
| 1814 |
+
[dcl.fct.def.delete]: dcl.md#dcl.fct.def.delete
|
| 1815 |
[dcl.fct.default]: dcl.md#dcl.fct.default
|
| 1816 |
[dcl.init]: dcl.md#dcl.init
|
| 1817 |
[dcl.inline]: dcl.md#dcl.inline
|
| 1818 |
[dcl.link]: dcl.md#dcl.link
|
| 1819 |
[dcl.pre]: dcl.md#dcl.pre
|
| 1820 |
[dcl.typedef]: dcl.md#dcl.typedef
|
| 1821 |
+
[debugging]: diagnostics.md#debugging
|
| 1822 |
+
[defns.const.subexpr]: intro.md#defns.const.subexpr
|
| 1823 |
[defns.nonconst.libcall]: intro.md#defns.nonconst.libcall
|
| 1824 |
+
[defns.valid]: intro.md#defns.valid
|
| 1825 |
[depr]: future.md#depr
|
| 1826 |
[derivation]: #derivation
|
| 1827 |
[derived.classes]: #derived.classes
|
| 1828 |
[description]: #description
|
| 1829 |
[description.general]: #description.general
|
| 1830 |
[diagnostics]: diagnostics.md#diagnostics
|
| 1831 |
[enumerated.types]: #enumerated.types
|
| 1832 |
+
[errno]: diagnostics.md#errno
|
| 1833 |
[except]: except.md#except
|
| 1834 |
+
[except.handle]: except.md#except.handle
|
| 1835 |
+
[except.spec]: except.md#except.spec
|
| 1836 |
+
[exec]: exec.md#exec
|
| 1837 |
+
[execpol]: algorithms.md#execpol
|
| 1838 |
+
[expected]: utilities.md#expected
|
| 1839 |
[expos.only.entity]: #expos.only.entity
|
| 1840 |
+
[expr.call]: expr.md#expr.call
|
| 1841 |
[expr.delete]: expr.md#expr.delete
|
| 1842 |
[expr.new]: expr.md#expr.new
|
| 1843 |
[expr.unary.op]: expr.md#expr.unary.op
|
| 1844 |
[extern.names]: #extern.names
|
| 1845 |
[extern.types]: #extern.types
|
|
|
|
| 1852 |
[headers]: #headers
|
| 1853 |
[headers.cpp]: #headers.cpp
|
| 1854 |
[headers.cpp.c]: #headers.cpp.c
|
| 1855 |
[headers.cpp.fs]: #headers.cpp.fs
|
| 1856 |
[hidden.friends]: #hidden.friends
|
| 1857 |
+
[inplace.vector]: containers.md#inplace.vector
|
| 1858 |
[input.output]: input.md#input.output
|
| 1859 |
[intro.compliance]: intro.md#intro.compliance
|
| 1860 |
[intro.multithread]: basic.md#intro.multithread
|
| 1861 |
+
[intro.races]: basic.md#intro.races
|
| 1862 |
[intro.refs]: intro.md#intro.refs
|
| 1863 |
[iterator.requirements]: iterators.md#iterator.requirements
|
| 1864 |
[iterators]: iterators.md#iterators
|
| 1865 |
[lex.charset]: lex.md#lex.charset
|
| 1866 |
[lex.name]: lex.md#lex.name
|
|
|
|
| 1867 |
[lex.phases]: lex.md#lex.phases
|
| 1868 |
[lex.separate]: lex.md#lex.separate
|
| 1869 |
[lib.types.movedfrom]: #lib.types.movedfrom
|
| 1870 |
[library]: #library
|
| 1871 |
[library.c]: #library.c
|
| 1872 |
[library.categories]: #library.categories
|
| 1873 |
+
[library.class.props]: #library.class.props
|
| 1874 |
[library.general]: #library.general
|
| 1875 |
+
[locales]: text.md#locales
|
|
|
|
| 1876 |
[macro.names]: #macro.names
|
| 1877 |
[mem]: mem.md#mem
|
| 1878 |
[member.functions]: #member.functions
|
| 1879 |
[memory]: mem.md#memory
|
| 1880 |
[meta]: meta.md#meta
|
|
|
|
| 1884 |
[namespace.def]: dcl.md#namespace.def
|
| 1885 |
[namespace.future]: #namespace.future
|
| 1886 |
[namespace.posix]: #namespace.posix
|
| 1887 |
[namespace.std]: #namespace.std
|
| 1888 |
[namespace.udecl]: dcl.md#namespace.udecl
|
|
|
|
| 1889 |
[new.handler]: support.md#new.handler
|
|
|
|
| 1890 |
[nullablepointer.requirements]: #nullablepointer.requirements
|
| 1891 |
[numeric.requirements]: numerics.md#numeric.requirements
|
| 1892 |
[numerics]: numerics.md#numerics
|
| 1893 |
+
[obj.lifetime]: mem.md#obj.lifetime
|
| 1894 |
[objects.within.classes]: #objects.within.classes
|
| 1895 |
+
[optional]: utilities.md#optional
|
| 1896 |
[organization]: #organization
|
| 1897 |
[organization.general]: #organization.general
|
| 1898 |
[ostream.iterator.ops]: iterators.md#ostream.iterator.ops
|
| 1899 |
[over.literal]: over.md#over.literal
|
| 1900 |
[over.match]: over.md#over.match
|
| 1901 |
[over.match.oper]: over.md#over.match.oper
|
| 1902 |
[protection.within.classes]: #protection.within.classes
|
| 1903 |
+
[rand]: numerics.md#rand
|
| 1904 |
[random.access.iterators]: iterators.md#random.access.iterators
|
| 1905 |
[ranges]: ranges.md#ranges
|
| 1906 |
[ratio]: meta.md#ratio
|
| 1907 |
+
[re]: text.md#re
|
| 1908 |
[reentrancy]: #reentrancy
|
| 1909 |
[replacement.functions]: #replacement.functions
|
| 1910 |
[requirements]: #requirements
|
| 1911 |
[requirements.general]: #requirements.general
|
| 1912 |
+
[res.contract.assertions]: #res.contract.assertions
|
| 1913 |
[res.on.arguments]: #res.on.arguments
|
| 1914 |
[res.on.data.races]: #res.on.data.races
|
| 1915 |
[res.on.exception.handling]: #res.on.exception.handling
|
| 1916 |
[res.on.functions]: #res.on.functions
|
| 1917 |
[res.on.headers]: #res.on.headers
|
|
|
|
| 1921 |
[reserved.names]: #reserved.names
|
| 1922 |
[reserved.names.general]: #reserved.names.general
|
| 1923 |
[specialized.addressof]: mem.md#specialized.addressof
|
| 1924 |
[std.exceptions]: diagnostics.md#std.exceptions
|
| 1925 |
[std.modules]: #std.modules
|
| 1926 |
+
[stdbit.h.syn]: utilities.md#stdbit.h.syn
|
| 1927 |
[stmt.return]: stmt.md#stmt.return
|
| 1928 |
[stream.types]: input.md#stream.types
|
| 1929 |
+
[string.classes]: strings.md#string.classes
|
| 1930 |
+
[string.view]: strings.md#string.view
|
| 1931 |
[strings]: strings.md#strings
|
| 1932 |
[structure]: #structure
|
| 1933 |
[structure.elements]: #structure.elements
|
| 1934 |
[structure.requirements]: #structure.requirements
|
| 1935 |
[structure.see.also]: #structure.see.also
|
| 1936 |
[structure.specifications]: #structure.specifications
|
| 1937 |
[structure.summary]: #structure.summary
|
| 1938 |
[support]: support.md#support
|
| 1939 |
[support.c.headers]: support.md#support.c.headers
|
| 1940 |
[support.c.headers.other]: support.md#support.c.headers.other
|
| 1941 |
+
[support.contract]: support.md#support.contract
|
| 1942 |
[support.coroutine]: support.md#support.coroutine
|
| 1943 |
[support.dynamic]: support.md#support.dynamic
|
| 1944 |
[support.exception]: support.md#support.exception
|
| 1945 |
[support.initlist]: support.md#support.initlist
|
| 1946 |
[support.limits]: support.md#support.limits
|
| 1947 |
[support.rtti]: support.md#support.rtti
|
| 1948 |
[support.runtime]: support.md#support.runtime
|
| 1949 |
[support.srcloc]: support.md#support.srcloc
|
|
|
|
| 1950 |
[support.types]: support.md#support.types
|
| 1951 |
[swappable.requirements]: #swappable.requirements
|
| 1952 |
[syserr]: diagnostics.md#syserr
|
| 1953 |
[syserr.errcode.overview]: diagnostics.md#syserr.errcode.overview
|
| 1954 |
[tab:cpp17.destructible]: #tab:cpp17.destructible
|
|
|
|
| 1958 |
[temp.constr.decl]: temp.md#temp.constr.decl
|
| 1959 |
[temp.deduct.call]: temp.md#temp.deduct.call
|
| 1960 |
[template.bitset]: utilities.md#template.bitset
|
| 1961 |
[term.incomplete.type]: basic.md#term.incomplete.type
|
| 1962 |
[term.object.type]: basic.md#term.object.type
|
| 1963 |
+
[term.replaceable.function]: dcl.md#term.replaceable.function
|
| 1964 |
[terminate.handler]: support.md#terminate.handler
|
| 1965 |
+
[text]: text.md#text
|
| 1966 |
[thread]: thread.md#thread
|
| 1967 |
[time]: time.md#time
|
| 1968 |
[tuple]: utilities.md#tuple
|
| 1969 |
[type.descriptions]: #type.descriptions
|
| 1970 |
[type.descriptions.general]: #type.descriptions.general
|
|
|
|
| 1978 |
[utility]: utilities.md#utility
|
| 1979 |
[utility.arg.requirements]: #utility.arg.requirements
|
| 1980 |
[utility.requirements]: #utility.requirements
|
| 1981 |
[utility.requirements.general]: #utility.requirements.general
|
| 1982 |
[value.error.codes]: #value.error.codes
|
| 1983 |
+
[variant]: utilities.md#variant
|
| 1984 |
+
[views.contiguous]: containers.md#views.contiguous
|
| 1985 |
+
[views.multidim]: containers.md#views.multidim
|
| 1986 |
[zombie.names]: #zombie.names
|
| 1987 |
+
[zombie.names.fnmacro]: #zombie.names.fnmacro
|
| 1988 |
+
[zombie.names.header]: #zombie.names.header
|
| 1989 |
+
[zombie.names.objmacro]: #zombie.names.objmacro
|
| 1990 |
+
[zombie.names.std]: #zombie.names.std
|
| 1991 |
|
| 1992 |
+
[^1]: See also ISO/IEC 9899:2018 (C), 7.6.
|
| 1993 |
|
| 1994 |
[^2]: To save space, items that do not apply to a Clause are omitted.
|
| 1995 |
For example, if a Clause does not specify any requirements, there
|
| 1996 |
will be no “Requirements” subclause.
|
| 1997 |
|
|
|
|
| 2060 |
|
| 2061 |
[^19]: This is the same as the C standard library.
|
| 2062 |
|
| 2063 |
[^20]: The only reliable way to declare an object or function signature
|
| 2064 |
from the C standard library is by including the header that declares
|
| 2065 |
+
it, notwithstanding the latitude granted in ISO/IEC 9899:2018 (C),
|
| 2066 |
+
7.1.4.
|
| 2067 |
|
| 2068 |
[^21]: Any library code that instantiates other library templates must
|
| 2069 |
be prepared to work adequately with any user-supplied specialization
|
| 2070 |
that meets the minimum requirements of this document.
|
| 2071 |
|
|
|
|
| 2084 |
|
| 2085 |
[^25]: A valid C++ program always calls the expected library non-member
|
| 2086 |
function. An implementation can also define additional non-member
|
| 2087 |
functions that would otherwise not be called by a valid C++ program.
|
| 2088 |
|
| 2089 |
+
[^26]: That is, the C standard library functions can all be treated as
|
| 2090 |
+
if they are marked `noexcept`. This allows implementations to make
|
| 2091 |
performance optimizations based on the absence of exceptions at
|
| 2092 |
runtime.
|
| 2093 |
|
| 2094 |
[^27]: The functions `qsort()` and `bsearch()` [[alg.c.library]] meet
|
| 2095 |
this condition.
|