- tmp/tmpuipvr1y7/{from.md → to.md} +157 -77
tmp/tmpuipvr1y7/{from.md → to.md}
RENAMED
|
@@ -1,29 +1,36 @@
|
|
| 1 |
### Constraints on programs <a id="constraints">[[constraints]]</a>
|
| 2 |
|
| 3 |
#### Overview <a id="constraints.overview">[[constraints.overview]]</a>
|
| 4 |
|
| 5 |
-
|
| 6 |
-
facilities of the C++standard library. The following subclauses
|
| 7 |
-
constraints on the program’s use of namespaces
|
| 8 |
-
use of various reserved names
|
| 9 |
-
headers
|
| 10 |
-
classes
|
| 11 |
-
functions
|
| 12 |
-
functions during execution
|
| 13 |
|
| 14 |
#### Namespace use <a id="namespace.constraints">[[namespace.constraints]]</a>
|
| 15 |
|
| 16 |
##### Namespace `std` <a id="namespace.std">[[namespace.std]]</a>
|
| 17 |
|
| 18 |
-
|
| 19 |
-
definitions to namespace `std` or to a
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
The behavior of a C++ program is undefined if it declares
|
| 27 |
|
| 28 |
- an explicit specialization of any member function of a standard
|
| 29 |
library class template, or
|
|
@@ -31,33 +38,62 @@ The behavior of a C++program is undefined if it declares
|
|
| 31 |
standard library class or class template, or
|
| 32 |
- an explicit or partial specialization of any member class template of
|
| 33 |
a standard library class or class template, or
|
| 34 |
- a deduction guide for any standard library class template.
|
| 35 |
|
| 36 |
-
A program may explicitly instantiate a template defined in the
|
| 37 |
-
library only if the declaration depends on the name of
|
| 38 |
-
type and the instantiation meets the
|
| 39 |
-
the original template.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
A translation unit shall not declare namespace `std` to be an inline
|
| 42 |
-
namespace
|
| 43 |
|
| 44 |
##### Namespace `posix` <a id="namespace.posix">[[namespace.posix]]</a>
|
| 45 |
|
| 46 |
The behavior of a C++ program is undefined if it adds declarations or
|
| 47 |
definitions to namespace `posix` or to a namespace within namespace
|
| 48 |
`posix` unless otherwise specified. The namespace `posix` is reserved
|
| 49 |
for use by ISO/IEC 9945 and other POSIX standards.
|
| 50 |
|
| 51 |
##### Namespaces for future standardization <a id="namespace.future">[[namespace.future]]</a>
|
| 52 |
|
| 53 |
-
Top
|
| 54 |
-
|
| 55 |
-
The behavior of a C++program is undefined if it adds
|
| 56 |
-
definitions to such a namespace.
|
| 57 |
|
| 58 |
-
[*Example 1*: The top
|
| 59 |
future revisions of this International Standard. — *end example*]
|
| 60 |
|
| 61 |
#### Reserved names <a id="reserved.names">[[reserved.names]]</a>
|
| 62 |
|
| 63 |
The C++ standard library reserves the following kinds of names:
|
|
@@ -74,101 +110,133 @@ is undefined.
|
|
| 74 |
|
| 75 |
In namespace `std`, the following names are reserved for previous
|
| 76 |
standardization:
|
| 77 |
|
| 78 |
- `auto_ptr`,
|
|
|
|
| 79 |
- `binary_function`,
|
|
|
|
| 80 |
- `bind1st`,
|
| 81 |
- `bind2nd`,
|
| 82 |
- `binder1st`,
|
| 83 |
- `binder2nd`,
|
| 84 |
- `const_mem_fun1_ref_t`,
|
| 85 |
- `const_mem_fun1_t`,
|
| 86 |
- `const_mem_fun_ref_t`,
|
| 87 |
- `const_mem_fun_t`,
|
|
|
|
| 88 |
- `get_unexpected`,
|
|
|
|
|
|
|
|
|
|
| 89 |
- `mem_fun1_ref_t`,
|
| 90 |
- `mem_fun1_t`,
|
| 91 |
- `mem_fun_ref_t`,
|
| 92 |
- `mem_fun_ref`,
|
| 93 |
- `mem_fun_t`,
|
| 94 |
- `mem_fun`,
|
|
|
|
|
|
|
| 95 |
- `pointer_to_binary_function`,
|
| 96 |
- `pointer_to_unary_function`,
|
| 97 |
- `ptr_fun`,
|
| 98 |
- `random_shuffle`,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
- `set_unexpected`,
|
| 100 |
- `unary_function`,
|
|
|
|
|
|
|
| 101 |
- `unexpected`, and
|
| 102 |
- `unexpected_handler`.
|
| 103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
##### Macro names <a id="macro.names">[[macro.names]]</a>
|
| 105 |
|
| 106 |
A translation unit that includes a standard library header shall not
|
| 107 |
`#define` or `#undef` names declared in any standard library header.
|
| 108 |
|
| 109 |
A translation unit shall not `#define` or `#undef` names lexically
|
| 110 |
-
identical to keywords, to the identifiers listed in
|
| 111 |
-
[[
|
| 112 |
-
[[dcl.attr]]
|
|
|
|
| 113 |
|
| 114 |
##### External linkage <a id="extern.names">[[extern.names]]</a>
|
| 115 |
|
| 116 |
Each name declared as an object with external linkage in a header is
|
| 117 |
reserved to the implementation to designate that library object with
|
| 118 |
-
external linkage, [^
|
| 119 |
namespace.
|
| 120 |
|
| 121 |
Each global function signature declared with external linkage in a
|
| 122 |
header is reserved to the implementation to designate that function
|
| 123 |
-
signature with external linkage.[^
|
| 124 |
|
| 125 |
Each name from the C standard library declared with external linkage is
|
| 126 |
reserved to the implementation for use as a name with `extern "C"`
|
| 127 |
linkage, both in namespace `std` and in the global namespace.
|
| 128 |
|
| 129 |
Each function signature from the C standard library declared with
|
| 130 |
external linkage is reserved to the implementation for use as a function
|
| 131 |
-
signature with both `extern "C"` and `extern "C++"` linkage,[^
|
| 132 |
a name of namespace scope in the global namespace.
|
| 133 |
|
| 134 |
##### Types <a id="extern.types">[[extern.types]]</a>
|
| 135 |
|
| 136 |
-
For each type T from the C standard library,
|
| 137 |
`std::T` are reserved to the implementation and, when defined, `::T`
|
| 138 |
shall be identical to `std::T`.
|
| 139 |
|
| 140 |
##### User-defined literal suffixes <a id="usrlit.suffix">[[usrlit.suffix]]</a>
|
| 141 |
|
| 142 |
-
Literal suffix identifiers
|
| 143 |
underscore are reserved for future standardization.
|
| 144 |
|
| 145 |
#### Headers <a id="alt.headers">[[alt.headers]]</a>
|
| 146 |
|
| 147 |
If a file with a name equivalent to the derived file name for one of the
|
| 148 |
C++ standard library headers is not provided as part of the
|
| 149 |
implementation, and a file with that name is placed in any of the
|
| 150 |
-
standard places for a source file to be included
|
| 151 |
behavior is undefined.
|
| 152 |
|
| 153 |
#### Derived classes <a id="derived.classes">[[derived.classes]]</a>
|
| 154 |
|
| 155 |
-
Virtual member function signatures defined for a base class in the
|
| 156 |
-
|
| 157 |
-
program
|
| 158 |
|
| 159 |
#### Replacement functions <a id="replacement.functions">[[replacement.functions]]</a>
|
| 160 |
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
program ([[definitions]]).
|
| 166 |
|
| 167 |
-
A C++program may provide the definition for any of the following
|
| 168 |
-
memory allocation function signatures declared in header
|
| 169 |
-
[[basic.stc.dynamic]], [[
|
| 170 |
|
| 171 |
``` cpp
|
| 172 |
operator new(std::size_t)
|
| 173 |
operator new(std::size_t, std::align_val_t)
|
| 174 |
operator new(std::size_t, const std::nothrow_t&)
|
|
@@ -199,19 +267,19 @@ operator delete[](void*, std::size_t, std::align_val_t)
|
|
| 199 |
operator delete[](void*, const std::nothrow_t&)
|
| 200 |
operator delete[](void*, std::align_val_t, const std::nothrow_t&)
|
| 201 |
```
|
| 202 |
|
| 203 |
The program’s definitions are used instead of the default versions
|
| 204 |
-
supplied by the implementation
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
|
| 209 |
#### Handler functions <a id="handler.functions">[[handler.functions]]</a>
|
| 210 |
|
| 211 |
The C++ standard library provides a default version of the following
|
| 212 |
-
handler function
|
| 213 |
|
| 214 |
- `terminate_handler`
|
| 215 |
|
| 216 |
A C++ program may install different handler functions during execution,
|
| 217 |
by supplying a pointer to a function defined in the program or the
|
|
@@ -237,34 +305,34 @@ function.
|
|
| 237 |
#### Other functions <a id="res.on.functions">[[res.on.functions]]</a>
|
| 238 |
|
| 239 |
In certain cases (replacement functions, handler functions, operations
|
| 240 |
on types used to instantiate standard library template components), the
|
| 241 |
C++ standard library depends on components supplied by a C++ program. If
|
| 242 |
-
these components do not meet their requirements, this
|
| 243 |
-
|
| 244 |
|
| 245 |
In particular, the effects are undefined in the following cases:
|
| 246 |
|
| 247 |
-
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
-
|
| 251 |
the installed handler function does not implement the semantics of the
|
| 252 |
-
applicable *Required behavior:* paragraph
|
| 253 |
-
-
|
| 254 |
component, if the operations on the type do not implement the
|
| 255 |
semantics of the applicable *Requirements* subclause (
|
| 256 |
[[allocator.requirements]], [[container.requirements]],
|
| 257 |
[[iterator.requirements]], [[algorithms.requirements]],
|
| 258 |
[[numeric.requirements]]). Operations on such types can report a
|
| 259 |
failure by throwing an exception unless otherwise specified.
|
| 260 |
-
-
|
| 261 |
operation exits via an exception, unless specifically allowed in the
|
| 262 |
applicable *Required behavior:* paragraph.
|
| 263 |
-
-
|
| 264 |
-
|
| 265 |
-
allowed for that component.
|
| 266 |
|
| 267 |
#### Function arguments <a id="res.on.arguments">[[res.on.arguments]]</a>
|
| 268 |
|
| 269 |
Each of the following applies to all arguments to functions defined in
|
| 270 |
the C++ standard library, unless explicitly stated otherwise.
|
|
@@ -279,41 +347,53 @@ the C++standard library, unless explicitly stated otherwise.
|
|
| 279 |
fact valid.
|
| 280 |
- If a function argument binds to an rvalue reference parameter, the
|
| 281 |
implementation may assume that this parameter is a unique reference to
|
| 282 |
this argument. \[*Note 1*: If the parameter is a generic parameter of
|
| 283 |
the form `T&&` and an lvalue of type `A` is bound, the argument binds
|
| 284 |
-
to an lvalue reference
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
|
| 293 |
#### Library object access <a id="res.on.objects">[[res.on.objects]]</a>
|
| 294 |
|
| 295 |
The behavior of a program is undefined if calls to standard library
|
| 296 |
functions from different threads may introduce a data race. The
|
| 297 |
conditions under which this may occur are specified in
|
| 298 |
[[res.on.data.races]].
|
| 299 |
|
| 300 |
[*Note 1*: Modifying an object of a standard library type that is
|
| 301 |
shared between threads risks undefined behavior unless objects of that
|
| 302 |
-
type are explicitly specified as being
|
| 303 |
the user supplies a locking mechanism. — *end note*]
|
| 304 |
|
| 305 |
If an object of a standard library type is accessed, and the beginning
|
| 306 |
-
of the object’s lifetime
|
| 307 |
access, or the access does not happen before the end of the object’s
|
| 308 |
lifetime, the behavior is undefined unless otherwise specified.
|
| 309 |
|
| 310 |
[*Note 2*: This applies even to objects such as mutexes intended for
|
| 311 |
thread synchronization. — *end note*]
|
| 312 |
|
| 313 |
-
####
|
| 314 |
|
| 315 |
-
Violation of
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
|
|
|
|
| 1 |
### Constraints on programs <a id="constraints">[[constraints]]</a>
|
| 2 |
|
| 3 |
#### Overview <a id="constraints.overview">[[constraints.overview]]</a>
|
| 4 |
|
| 5 |
+
Subclause [[constraints]] describes restrictions on C++ programs that
|
| 6 |
+
use the facilities of the C++ standard library. The following subclauses
|
| 7 |
+
specify constraints on the program’s use of namespaces
|
| 8 |
+
[[namespace.std]], its use of various reserved names [[reserved.names]],
|
| 9 |
+
its use of headers [[alt.headers]], its use of standard library classes
|
| 10 |
+
as base classes [[derived.classes]], its definitions of replacement
|
| 11 |
+
functions [[replacement.functions]], and its installation of handler
|
| 12 |
+
functions during execution [[handler.functions]].
|
| 13 |
|
| 14 |
#### Namespace use <a id="namespace.constraints">[[namespace.constraints]]</a>
|
| 15 |
|
| 16 |
##### Namespace `std` <a id="namespace.std">[[namespace.std]]</a>
|
| 17 |
|
| 18 |
+
Unless otherwise specified, the behavior of a C++ program is undefined
|
| 19 |
+
if it adds declarations or definitions to namespace `std` or to a
|
| 20 |
+
namespace within namespace `std`.
|
| 21 |
+
|
| 22 |
+
Unless explicitly prohibited, a program may add a template
|
| 23 |
+
specialization for any standard library class template to namespace
|
| 24 |
+
`std` provided that (a) the added declaration depends on at least one
|
| 25 |
+
program-defined type and (b) the specialization meets the standard
|
| 26 |
+
library requirements for the original template.[^21]
|
| 27 |
+
|
| 28 |
+
The behavior of a C++ program is undefined if it declares an explicit or
|
| 29 |
+
partial specialization of any standard library variable template, except
|
| 30 |
+
where explicitly permitted by the specification of that variable
|
| 31 |
+
template.
|
| 32 |
|
| 33 |
The behavior of a C++ program is undefined if it declares
|
| 34 |
|
| 35 |
- an explicit specialization of any member function of a standard
|
| 36 |
library class template, or
|
|
|
|
| 38 |
standard library class or class template, or
|
| 39 |
- an explicit or partial specialization of any member class template of
|
| 40 |
a standard library class or class template, or
|
| 41 |
- a deduction guide for any standard library class template.
|
| 42 |
|
| 43 |
+
A program may explicitly instantiate a class template defined in the
|
| 44 |
+
standard library only if the declaration (a) depends on the name of at
|
| 45 |
+
least one program-defined type and (b) the instantiation meets the
|
| 46 |
+
standard library requirements for the original template.
|
| 47 |
+
|
| 48 |
+
Let `F` denote a standard library function [[global.functions]], a
|
| 49 |
+
standard library static member function, or an instantiation of a
|
| 50 |
+
standard library function template. Unless `F` is designated an
|
| 51 |
+
*addressable function*, the behavior of a C++ program is unspecified
|
| 52 |
+
(possibly ill-formed) if it explicitly or implicitly attempts to form a
|
| 53 |
+
pointer to `F`.
|
| 54 |
+
|
| 55 |
+
[*Note 1*: Possible means of forming such pointers include application
|
| 56 |
+
of the unary `&` operator [[expr.unary.op]], `addressof`
|
| 57 |
+
[[specialized.addressof]], or a function-to-pointer standard conversion
|
| 58 |
+
[[conv.func]]. — *end note*]
|
| 59 |
+
|
| 60 |
+
Moreover, the behavior of a C++ program is unspecified (possibly
|
| 61 |
+
ill-formed) if it attempts to form a reference to `F` or if it attempts
|
| 62 |
+
to form a pointer-to-member designating either a standard library
|
| 63 |
+
non-static member function [[member.functions]] or an instantiation of a
|
| 64 |
+
standard library member function template.
|
| 65 |
+
|
| 66 |
+
Other than in namespace `std` or in a namespace within namespace `std`,
|
| 67 |
+
a program may provide an overload for any library function template
|
| 68 |
+
designated as a *customization point*, provided that (a) the overload’s
|
| 69 |
+
declaration depends on at least one user-defined type and (b) the
|
| 70 |
+
overload meets the standard library requirements for the customization
|
| 71 |
+
point. [^22]
|
| 72 |
+
|
| 73 |
+
[*Note 2*: This permits a (qualified or unqualified) call to the
|
| 74 |
+
customization point to invoke the most appropriate overload for the
|
| 75 |
+
given arguments. — *end note*]
|
| 76 |
|
| 77 |
A translation unit shall not declare namespace `std` to be an inline
|
| 78 |
+
namespace [[namespace.def]].
|
| 79 |
|
| 80 |
##### Namespace `posix` <a id="namespace.posix">[[namespace.posix]]</a>
|
| 81 |
|
| 82 |
The behavior of a C++ program is undefined if it adds declarations or
|
| 83 |
definitions to namespace `posix` or to a namespace within namespace
|
| 84 |
`posix` unless otherwise specified. The namespace `posix` is reserved
|
| 85 |
for use by ISO/IEC 9945 and other POSIX standards.
|
| 86 |
|
| 87 |
##### Namespaces for future standardization <a id="namespace.future">[[namespace.future]]</a>
|
| 88 |
|
| 89 |
+
Top-level namespaces whose *namespace-name* consists of `std` followed
|
| 90 |
+
by one or more *digit*s [[lex.name]] are reserved for future
|
| 91 |
+
standardization. The behavior of a C++ program is undefined if it adds
|
| 92 |
+
declarations or definitions to such a namespace.
|
| 93 |
|
| 94 |
+
[*Example 1*: The top-level namespace `std2` is reserved for use by
|
| 95 |
future revisions of this International Standard. — *end example*]
|
| 96 |
|
| 97 |
#### Reserved names <a id="reserved.names">[[reserved.names]]</a>
|
| 98 |
|
| 99 |
The C++ standard library reserves the following kinds of names:
|
|
|
|
| 110 |
|
| 111 |
In namespace `std`, the following names are reserved for previous
|
| 112 |
standardization:
|
| 113 |
|
| 114 |
- `auto_ptr`,
|
| 115 |
+
- `auto_ptr_ref`,
|
| 116 |
- `binary_function`,
|
| 117 |
+
- `binary_negate`,
|
| 118 |
- `bind1st`,
|
| 119 |
- `bind2nd`,
|
| 120 |
- `binder1st`,
|
| 121 |
- `binder2nd`,
|
| 122 |
- `const_mem_fun1_ref_t`,
|
| 123 |
- `const_mem_fun1_t`,
|
| 124 |
- `const_mem_fun_ref_t`,
|
| 125 |
- `const_mem_fun_t`,
|
| 126 |
+
- `get_temporary_buffer`,
|
| 127 |
- `get_unexpected`,
|
| 128 |
+
- `gets`,
|
| 129 |
+
- `is_literal_type`,
|
| 130 |
+
- `is_literal_type_v`,
|
| 131 |
- `mem_fun1_ref_t`,
|
| 132 |
- `mem_fun1_t`,
|
| 133 |
- `mem_fun_ref_t`,
|
| 134 |
- `mem_fun_ref`,
|
| 135 |
- `mem_fun_t`,
|
| 136 |
- `mem_fun`,
|
| 137 |
+
- `not1`,
|
| 138 |
+
- `not2`,
|
| 139 |
- `pointer_to_binary_function`,
|
| 140 |
- `pointer_to_unary_function`,
|
| 141 |
- `ptr_fun`,
|
| 142 |
- `random_shuffle`,
|
| 143 |
+
- `raw_storage_iterator`,
|
| 144 |
+
- `result_of`,
|
| 145 |
+
- `result_of_t`,
|
| 146 |
+
- `return_temporary_buffer`,
|
| 147 |
- `set_unexpected`,
|
| 148 |
- `unary_function`,
|
| 149 |
+
- `unary_negate`,
|
| 150 |
+
- `uncaught_exception`,
|
| 151 |
- `unexpected`, and
|
| 152 |
- `unexpected_handler`.
|
| 153 |
|
| 154 |
+
The following names are reserved as member types for previous
|
| 155 |
+
standardization, and may not be used as a name for object-like macros in
|
| 156 |
+
portable code:
|
| 157 |
+
|
| 158 |
+
- `argument_type`,
|
| 159 |
+
- `first_argument_type`,
|
| 160 |
+
- `io_state`,
|
| 161 |
+
- `open_mode`,
|
| 162 |
+
- `second_argument_type`, and
|
| 163 |
+
- `seek_dir`.
|
| 164 |
+
|
| 165 |
+
The name `stossc` is reserved as a member function for previous
|
| 166 |
+
standardization, and may not be used as a name for function-like macros
|
| 167 |
+
in portable code.
|
| 168 |
+
|
| 169 |
+
The header names `<ccomplex>`, `<ciso646>`, `<cstdalign>`, `<cstdbool>`,
|
| 170 |
+
and `<ctgmath>` are reserved for previous standardization.
|
| 171 |
+
|
| 172 |
##### Macro names <a id="macro.names">[[macro.names]]</a>
|
| 173 |
|
| 174 |
A translation unit that includes a standard library header shall not
|
| 175 |
`#define` or `#undef` names declared in any standard library header.
|
| 176 |
|
| 177 |
A translation unit shall not `#define` or `#undef` names lexically
|
| 178 |
+
identical to keywords, to the identifiers listed in
|
| 179 |
+
[[lex.name.special]], or to the *attribute-token*s described in
|
| 180 |
+
[[dcl.attr]], except that the names `likely` and `unlikely` may be
|
| 181 |
+
defined as function-like macros [[cpp.replace]].
|
| 182 |
|
| 183 |
##### External linkage <a id="extern.names">[[extern.names]]</a>
|
| 184 |
|
| 185 |
Each name declared as an object with external linkage in a header is
|
| 186 |
reserved to the implementation to designate that library object with
|
| 187 |
+
external linkage, [^23] both in namespace `std` and in the global
|
| 188 |
namespace.
|
| 189 |
|
| 190 |
Each global function signature declared with external linkage in a
|
| 191 |
header is reserved to the implementation to designate that function
|
| 192 |
+
signature with external linkage.[^24]
|
| 193 |
|
| 194 |
Each name from the C standard library declared with external linkage is
|
| 195 |
reserved to the implementation for use as a name with `extern "C"`
|
| 196 |
linkage, both in namespace `std` and in the global namespace.
|
| 197 |
|
| 198 |
Each function signature from the C standard library declared with
|
| 199 |
external linkage is reserved to the implementation for use as a function
|
| 200 |
+
signature with both `extern "C"` and `extern "C++"` linkage,[^25] or as
|
| 201 |
a name of namespace scope in the global namespace.
|
| 202 |
|
| 203 |
##### Types <a id="extern.types">[[extern.types]]</a>
|
| 204 |
|
| 205 |
+
For each type `T` from the C standard library, the types `::T` and
|
| 206 |
`std::T` are reserved to the implementation and, when defined, `::T`
|
| 207 |
shall be identical to `std::T`.
|
| 208 |
|
| 209 |
##### User-defined literal suffixes <a id="usrlit.suffix">[[usrlit.suffix]]</a>
|
| 210 |
|
| 211 |
+
Literal suffix identifiers [[over.literal]] that do not start with an
|
| 212 |
underscore are reserved for future standardization.
|
| 213 |
|
| 214 |
#### Headers <a id="alt.headers">[[alt.headers]]</a>
|
| 215 |
|
| 216 |
If a file with a name equivalent to the derived file name for one of the
|
| 217 |
C++ standard library headers is not provided as part of the
|
| 218 |
implementation, and a file with that name is placed in any of the
|
| 219 |
+
standard places for a source file to be included [[cpp.include]], the
|
| 220 |
behavior is undefined.
|
| 221 |
|
| 222 |
#### Derived classes <a id="derived.classes">[[derived.classes]]</a>
|
| 223 |
|
| 224 |
+
Virtual member function signatures defined for a base class in the C++
|
| 225 |
+
standard library may be overridden in a derived class defined in the
|
| 226 |
+
program [[class.virtual]].
|
| 227 |
|
| 228 |
#### Replacement functions <a id="replacement.functions">[[replacement.functions]]</a>
|
| 229 |
|
| 230 |
+
[[support]] through [[thread]] and [[depr]] describe the behavior of
|
| 231 |
+
numerous functions defined by the C++ standard library. Under some
|
| 232 |
+
circumstances, however, certain of these function descriptions also
|
| 233 |
+
apply to replacement functions defined in the program [[definitions]].
|
|
|
|
| 234 |
|
| 235 |
+
A C++ program may provide the definition for any of the following
|
| 236 |
+
dynamic memory allocation function signatures declared in header
|
| 237 |
+
`<new>` ([[basic.stc.dynamic]], [[new.syn]]):
|
| 238 |
|
| 239 |
``` cpp
|
| 240 |
operator new(std::size_t)
|
| 241 |
operator new(std::size_t, std::align_val_t)
|
| 242 |
operator new(std::size_t, const std::nothrow_t&)
|
|
|
|
| 267 |
operator delete[](void*, const std::nothrow_t&)
|
| 268 |
operator delete[](void*, std::align_val_t, const std::nothrow_t&)
|
| 269 |
```
|
| 270 |
|
| 271 |
The program’s definitions are used instead of the default versions
|
| 272 |
+
supplied by the implementation [[new.delete]]. Such replacement occurs
|
| 273 |
+
prior to program startup ([[basic.def.odr]], [[basic.start]]). The
|
| 274 |
+
program’s declarations shall not be specified as `inline`. No diagnostic
|
| 275 |
+
is required.
|
| 276 |
|
| 277 |
#### Handler functions <a id="handler.functions">[[handler.functions]]</a>
|
| 278 |
|
| 279 |
The C++ standard library provides a default version of the following
|
| 280 |
+
handler function [[support]]:
|
| 281 |
|
| 282 |
- `terminate_handler`
|
| 283 |
|
| 284 |
A C++ program may install different handler functions during execution,
|
| 285 |
by supplying a pointer to a function defined in the program or the
|
|
|
|
| 305 |
#### Other functions <a id="res.on.functions">[[res.on.functions]]</a>
|
| 306 |
|
| 307 |
In certain cases (replacement functions, handler functions, operations
|
| 308 |
on types used to instantiate standard library template components), the
|
| 309 |
C++ standard library depends on components supplied by a C++ program. If
|
| 310 |
+
these components do not meet their requirements, this document places no
|
| 311 |
+
requirements on the implementation.
|
| 312 |
|
| 313 |
In particular, the effects are undefined in the following cases:
|
| 314 |
|
| 315 |
+
- For replacement functions [[new.delete]], if the installed replacement
|
| 316 |
+
function does not implement the semantics of the applicable *Required
|
| 317 |
+
behavior:* paragraph.
|
| 318 |
+
- For handler functions ([[new.handler]], [[terminate.handler]]), if
|
| 319 |
the installed handler function does not implement the semantics of the
|
| 320 |
+
applicable *Required behavior:* paragraph.
|
| 321 |
+
- For types used as template arguments when instantiating a template
|
| 322 |
component, if the operations on the type do not implement the
|
| 323 |
semantics of the applicable *Requirements* subclause (
|
| 324 |
[[allocator.requirements]], [[container.requirements]],
|
| 325 |
[[iterator.requirements]], [[algorithms.requirements]],
|
| 326 |
[[numeric.requirements]]). Operations on such types can report a
|
| 327 |
failure by throwing an exception unless otherwise specified.
|
| 328 |
+
- If any replacement function or handler function or destructor
|
| 329 |
operation exits via an exception, unless specifically allowed in the
|
| 330 |
applicable *Required behavior:* paragraph.
|
| 331 |
+
- If an incomplete type [[basic.types]] is used as a template argument
|
| 332 |
+
when instantiating a template component or evaluating a concept,
|
| 333 |
+
unless specifically allowed for that component.
|
| 334 |
|
| 335 |
#### Function arguments <a id="res.on.arguments">[[res.on.arguments]]</a>
|
| 336 |
|
| 337 |
Each of the following applies to all arguments to functions defined in
|
| 338 |
the C++ standard library, unless explicitly stated otherwise.
|
|
|
|
| 347 |
fact valid.
|
| 348 |
- If a function argument binds to an rvalue reference parameter, the
|
| 349 |
implementation may assume that this parameter is a unique reference to
|
| 350 |
this argument. \[*Note 1*: If the parameter is a generic parameter of
|
| 351 |
the form `T&&` and an lvalue of type `A` is bound, the argument binds
|
| 352 |
+
to an lvalue reference [[temp.deduct.call]] and thus is not covered by
|
| 353 |
+
the previous sentence. — *end note*] \[*Note 2*: If a program casts
|
| 354 |
+
an lvalue to an xvalue while passing that lvalue to a library function
|
| 355 |
+
(e.g., by calling the function with the argument `std::move(x)`), the
|
| 356 |
+
program is effectively asking that function to treat that lvalue as a
|
| 357 |
+
temporary object. The implementation is free to optimize away aliasing
|
| 358 |
+
checks which might be needed if the argument was an
|
| 359 |
+
lvalue. — *end note*]
|
| 360 |
|
| 361 |
#### Library object access <a id="res.on.objects">[[res.on.objects]]</a>
|
| 362 |
|
| 363 |
The behavior of a program is undefined if calls to standard library
|
| 364 |
functions from different threads may introduce a data race. The
|
| 365 |
conditions under which this may occur are specified in
|
| 366 |
[[res.on.data.races]].
|
| 367 |
|
| 368 |
[*Note 1*: Modifying an object of a standard library type that is
|
| 369 |
shared between threads risks undefined behavior unless objects of that
|
| 370 |
+
type are explicitly specified as being shareable without data races or
|
| 371 |
the user supplies a locking mechanism. — *end note*]
|
| 372 |
|
| 373 |
If an object of a standard library type is accessed, and the beginning
|
| 374 |
+
of the object’s lifetime [[basic.life]] does not happen before the
|
| 375 |
access, or the access does not happen before the end of the object’s
|
| 376 |
lifetime, the behavior is undefined unless otherwise specified.
|
| 377 |
|
| 378 |
[*Note 2*: This applies even to objects such as mutexes intended for
|
| 379 |
thread synchronization. — *end note*]
|
| 380 |
|
| 381 |
+
#### Expects paragraph <a id="res.on.expects">[[res.on.expects]]</a>
|
| 382 |
|
| 383 |
+
Violation of any preconditions specified in a function’s
|
| 384 |
+
*Preconditions:* element results in undefined behavior.
|
| 385 |
+
|
| 386 |
+
#### Semantic requirements <a id="res.on.requirements">[[res.on.requirements]]</a>
|
| 387 |
+
|
| 388 |
+
A sequence `Args` of template arguments is said to *model* a concept `C`
|
| 389 |
+
if `Args` satisfies `C` [[temp.constr.decl]] and meets all semantic
|
| 390 |
+
requirements (if any) given in the specification of `C`.
|
| 391 |
+
|
| 392 |
+
If the validity or meaning of a program depends on whether a sequence of
|
| 393 |
+
template arguments models a concept, and the concept is satisfied but
|
| 394 |
+
not modeled, the program is ill-formed, no diagnostic required.
|
| 395 |
+
|
| 396 |
+
If the semantic requirements of a declaration’s constraints
|
| 397 |
+
[[structure.requirements]] are not modeled at the point of use, the
|
| 398 |
+
program is ill-formed, no diagnostic required.
|
| 399 |
|