- tmp/tmpjdp1v047/{from.md → to.md} +104 -42
tmp/tmpjdp1v047/{from.md → to.md}
RENAMED
|
@@ -191,58 +191,64 @@ terminating null character type value `charT()`
|
|
| 191 |
a class member function ([[class.mfct]]) that accesses the state of an
|
| 192 |
object of the class but does not alter that state
|
| 193 |
Observer functions are specified as `const` member functions (
|
| 194 |
[[class.this]]).
|
| 195 |
|
| 196 |
-
#### 19
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
a *non-reserved function* whose definition is provided by a C++program
|
| 199 |
Only one definition for such a function is in effect for the duration of
|
| 200 |
the program’s execution, as the result of creating the program (
|
| 201 |
[[lex.phases]]) and resolving the definitions of all translation units (
|
| 202 |
[[basic.link]]).
|
| 203 |
|
| 204 |
-
####
|
| 205 |
|
| 206 |
a stream (described in Clause [[input.output]]) that can seek to a
|
| 207 |
position that was previously encountered
|
| 208 |
|
| 209 |
-
####
|
| 210 |
|
| 211 |
a description of *replacement function* and *handler function* semantics
|
| 212 |
applicable to both the behavior provided by the implementation and the
|
| 213 |
behavior of any such function definition in the program
|
| 214 |
If such a function defined in a C++program fails to meet the required
|
| 215 |
behavior when it executes, the behavior is undefined.
|
| 216 |
|
| 217 |
-
####
|
| 218 |
|
| 219 |
a function, specified as part of the C++standard library, that must be
|
| 220 |
defined by the implementation
|
| 221 |
If a C++program provides a definition for any reserved function, the
|
| 222 |
results are undefined.
|
| 223 |
|
| 224 |
-
####
|
| 225 |
|
| 226 |
an algorithm that preserves, as appropriate to the particular algorithm,
|
| 227 |
the order of elements
|
| 228 |
Requirements for stable algorithms are given in [[algorithm.stable]].
|
| 229 |
|
| 230 |
-
####
|
| 231 |
|
| 232 |
a class that encapsulates a set of types and functions necessary for
|
| 233 |
class templates and function templates to manipulate objects of types
|
| 234 |
for which they are instantiated
|
| 235 |
Traits classes defined in Clauses [[strings]], [[localization]] and
|
| 236 |
[[input.output]] are *character traits*, which provide the character
|
| 237 |
handling support needed by the string and iostream classes.
|
| 238 |
|
| 239 |
-
####
|
| 240 |
|
| 241 |
place a thread in the unblocked state
|
| 242 |
|
| 243 |
-
####
|
| 244 |
|
| 245 |
an object state that is not specified except that the object’s
|
| 246 |
invariants are met and operations on the object behave as specified for
|
| 247 |
its type
|
| 248 |
If an object `x` of type `std::vector<int>` is in a valid but
|
|
@@ -316,11 +322,11 @@ Requirements are stated in terms of well-defined expressions that define
|
|
| 316 |
valid terms of the types that satisfy the requirements. For every set of
|
| 317 |
well-defined expression requirements there is a table that specifies an
|
| 318 |
initial set of the valid expressions and their semantics. Any generic
|
| 319 |
algorithm (Clause [[algorithms]]) that uses the well-defined expression
|
| 320 |
requirements is described in terms of the valid expressions for its
|
| 321 |
-
|
| 322 |
|
| 323 |
Template argument requirements are sometimes referenced by name. See
|
| 324 |
[[type.descriptions]].
|
| 325 |
|
| 326 |
In some cases the semantic requirements are presented as C++code. Such
|
|
@@ -495,21 +501,22 @@ bitmask{}& operator^=(bitmask{}& X, bitmask{} Y) {
|
|
| 495 |
X = X ^ Y; return X;
|
| 496 |
}
|
| 497 |
```
|
| 498 |
|
| 499 |
Here, the names *C0*, *C1*, etc. represent *bitmask elements* for this
|
| 500 |
-
particular bitmask type. All such elements have distinct
|
| 501 |
-
that, for any pair *Ci* and *Cj*
|
| 502 |
-
is zero.
|
|
|
|
| 503 |
|
| 504 |
The following terms apply to objects and values of bitmask types:
|
| 505 |
|
| 506 |
- To *set* a value *Y* in an object *X* is to evaluate the expression
|
| 507 |
-
*X* |= *Y*.
|
| 508 |
- To *clear* a value *Y* in an object *X* is to evaluate the expression
|
| 509 |
-
*X* &= ~*Y*.
|
| 510 |
-
- The value *Y* *is set* in the object *X* if the expression *X* & *Y*
|
| 511 |
is nonzero.
|
| 512 |
|
| 513 |
##### Character sequences <a id="character.seq">[[character.seq]]</a>
|
| 514 |
|
| 515 |
The C standard library makes widespread use of characters and character
|
|
@@ -638,11 +645,11 @@ function `::std::G` is meant.
|
|
| 638 |
#### Headers <a id="headers">[[headers]]</a>
|
| 639 |
|
| 640 |
Each element of the C++standard library is declared or defined (as
|
| 641 |
appropriate) in a *header*.[^16]
|
| 642 |
|
| 643 |
-
The C++standard library provides
|
| 644 |
Table [[tab:cpp.library.headers]].
|
| 645 |
|
| 646 |
**Table: C++library headers** <a id="tab:cpp.library.headers">[tab:cpp.library.headers]</a>
|
| 647 |
|
| 648 |
| | | | | |
|
|
@@ -755,11 +762,11 @@ either `<cassert>` or `<assert.h>` depends each time on the lexically
|
|
| 755 |
current definition of `NDEBUG`.[^20]
|
| 756 |
|
| 757 |
A translation unit shall include a header only outside of any external
|
| 758 |
declaration or definition, and shall include the header lexically before
|
| 759 |
the first reference in that translation unit to any of the entities
|
| 760 |
-
declared in that header.
|
| 761 |
|
| 762 |
#### Linkage <a id="using.linkage">[[using.linkage]]</a>
|
| 763 |
|
| 764 |
Entities in the C++standard library have external linkage (
|
| 765 |
[[basic.link]]). Unless otherwise specified, objects and functions have
|
|
@@ -855,15 +862,15 @@ signatures is called using the default argument ([[dcl.fct.default]]).
|
|
| 855 |
|
| 856 |
|
| 857 |
**Table: `Destructible` requirements** <a id="destructible">[destructible]</a>
|
| 858 |
|
| 859 |
| | |
|
| 860 |
-
| --------
|
| 861 |
-
| `u.
|
| 862 |
|
| 863 |
|
| 864 |
-
#### Swappable requirements <a id="swappable.requirements">[[swappable.requirements]]</a>
|
| 865 |
|
| 866 |
This subclause provides definitions for swappable types and expressions.
|
| 867 |
In these definitions, let `t` denote an expression of type `T`, and let
|
| 868 |
`u` denote an expression of type `U`.
|
| 869 |
|
|
@@ -897,12 +904,13 @@ evaluation context.
|
|
| 897 |
|
| 898 |
An rvalue or lvalue `t` is *swappable* if and only if `t` is swappable
|
| 899 |
with any rvalue or lvalue, respectively, of type `T`.
|
| 900 |
|
| 901 |
A type `X` satisfying any of the iterator requirements (
|
| 902 |
-
[[iterator.requirements]])
|
| 903 |
-
dereferenceable object `x` of type `X`,
|
|
|
|
| 904 |
|
| 905 |
User code can ensure that the evaluation of `swap` calls is performed in
|
| 906 |
an appropriate context under the various conditions as follows:
|
| 907 |
|
| 908 |
``` cpp
|
|
@@ -1007,12 +1015,12 @@ lvalue of type `Key`, and `k` is a value of a type convertible to
|
|
| 1007 |
(possibly `const`) `Key`.
|
| 1008 |
|
| 1009 |
**Table: `Hash` requirements** <a id="hash">[hash]</a>
|
| 1010 |
|
| 1011 |
| | | |
|
| 1012 |
-
| ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| 1013 |
-
| `h(k)` | `size_t` | The value returned shall depend only on the argument `k`. \enternote Thus all evaluations of the expression `h(k)` with the same value for `k` yield the same result. \exitnote \enternote For two different values `t1` and `t2`, the probability that `h(t1)` and `h(t2)` compare equal should be very small, approaching `1.0 / numeric_limits<size_t>::max()`. \exitnote |
|
| 1014 |
| `h(u)` | `size_t` | Shall not modify `u`. |
|
| 1015 |
|
| 1016 |
|
| 1017 |
#### Allocator requirements <a id="allocator.requirements">[[allocator.requirements]]</a>
|
| 1018 |
|
|
@@ -1052,17 +1060,54 @@ class template instantiation of the form `SomeAllocator<T, Args>`, where
|
|
| 1052 |
`rebind` member template, the standard `allocator_traits` template uses
|
| 1053 |
`SomeAllocator<U, Args>` in place of `Allocator::{}rebind<U>::other` by
|
| 1054 |
default. For allocator types that are not template instantiations of the
|
| 1055 |
above form, no default is provided.
|
| 1056 |
|
| 1057 |
-
|
| 1058 |
-
`X::
|
| 1059 |
-
`
|
| 1060 |
-
|
| 1061 |
-
|
| 1062 |
-
|
| 1063 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1064 |
|
| 1065 |
An allocator may constrain the types on which it can be instantiated and
|
| 1066 |
the arguments for which its `construct` member may be called. If a type
|
| 1067 |
cannot be used with a particular allocator, the allocator class or the
|
| 1068 |
call to `construct` may fail to instantiate.
|
|
@@ -1080,10 +1125,15 @@ struct SimpleAllocator {
|
|
| 1080 |
template <class T> SimpleAllocator(const SimpleAllocator<T>& other);
|
| 1081 |
|
| 1082 |
Tp* allocate(std::size_t n);
|
| 1083 |
void deallocate(Tp* p, std::size_t n);
|
| 1084 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1085 |
```
|
| 1086 |
|
| 1087 |
If the alignment associated with a specific over-aligned type is not
|
| 1088 |
supported by an allocator, instantiation of the allocator for that type
|
| 1089 |
may fail. The allocator also may silently ignore the requested
|
|
@@ -1223,11 +1273,11 @@ Clauses [[language.support]] through [[thread]] and Annex [[depr]]
|
|
| 1223 |
describe the behavior of numerous functions defined by the C++standard
|
| 1224 |
library. Under some circumstances, however, certain of these function
|
| 1225 |
descriptions also apply to replacement functions defined in the
|
| 1226 |
program ([[definitions]]).
|
| 1227 |
|
| 1228 |
-
A C++program may provide the definition for any of
|
| 1229 |
allocation function signatures declared in header `<new>` (
|
| 1230 |
[[basic.stc.dynamic]], [[support.dynamic]]):
|
| 1231 |
|
| 1232 |
- `operator new(std::size_t)`
|
| 1233 |
- `operator new(std::size_t, const std::nothrow_t&)`
|
|
@@ -1235,10 +1285,14 @@ allocation function signatures declared in header `<new>` (
|
|
| 1235 |
- `operator new[](std::size_t, const std::nothrow_t&)`
|
| 1236 |
- `operator delete(void*)`
|
| 1237 |
- `operator delete(void*, const std::nothrow_t&)`
|
| 1238 |
- `operator delete[](void*)`
|
| 1239 |
- `operator delete[](void*, const std::nothrow_t&)`
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1240 |
|
| 1241 |
The program’s definitions are used instead of the default versions
|
| 1242 |
supplied by the implementation ([[support.dynamic]]). Such replacement
|
| 1243 |
occurs prior to program startup ([[basic.def.odr]], [[basic.start]]).
|
| 1244 |
The program’s definitions shall not be specified as `inline`. No
|
|
@@ -1409,17 +1463,19 @@ signature with additional default arguments.
|
|
| 1409 |
Unless otherwise specified, global and non-member functions in the
|
| 1410 |
standard library shall not use functions from another namespace which
|
| 1411 |
are found through *argument-dependent name lookup* (
|
| 1412 |
[[basic.lookup.argdep]]). The phrase “unless otherwise specified” is
|
| 1413 |
intended to allow argument-dependent lookup in cases like that of
|
| 1414 |
-
`ostream_iterator
|
|
|
|
|
|
|
| 1415 |
|
| 1416 |
``` cpp
|
| 1417 |
*out_stream << value;
|
| 1418 |
if (delim != 0)
|
| 1419 |
*out_stream << delim;
|
| 1420 |
-
return
|
| 1421 |
```
|
| 1422 |
|
| 1423 |
#### Member functions <a id="member.functions">[[member.functions]]</a>
|
| 1424 |
|
| 1425 |
It is unspecified whether any member functions in the C++standard
|
|
@@ -1439,26 +1495,30 @@ A call to a member function signature described in the C++standard
|
|
| 1439 |
library behaves as if the implementation declares no additional member
|
| 1440 |
function signatures.[^29]
|
| 1441 |
|
| 1442 |
#### `constexpr` functions and constructors <a id="constexpr.functions">[[constexpr.functions]]</a>
|
| 1443 |
|
| 1444 |
-
|
| 1445 |
-
`constexpr`
|
| 1446 |
-
|
|
|
|
|
|
|
|
|
|
| 1447 |
|
| 1448 |
#### Requirements for stable algorithms <a id="algorithm.stable">[[algorithm.stable]]</a>
|
| 1449 |
|
| 1450 |
When the requirements for an algorithm state that it is “stable” without
|
| 1451 |
further elaboration, it means:
|
| 1452 |
|
| 1453 |
- For the *sort* algorithms the relative order of equivalent elements is
|
| 1454 |
preserved.
|
| 1455 |
-
- For the *remove* algorithms the relative order of the
|
| 1456 |
-
are not removed is preserved.
|
| 1457 |
- For the *merge* algorithms, for equivalent elements in the original
|
| 1458 |
-
two ranges, the elements from the first range
|
| 1459 |
-
from the second range
|
|
|
|
| 1460 |
|
| 1461 |
#### Reentrancy <a id="reentrancy">[[reentrancy]]</a>
|
| 1462 |
|
| 1463 |
Except where explicitly specified in this standard, it is
|
| 1464 |
*implementation-defined* which functions in the Standard C++ library may
|
|
@@ -1636,10 +1696,11 @@ objects shall be placed in a valid but unspecified state.
|
|
| 1636 |
[conventions]: #conventions
|
| 1637 |
[cpp.include]: cpp.md#cpp.include
|
| 1638 |
[cstdint]: language.md#cstdint
|
| 1639 |
[dcl.array]: dcl.md#dcl.array
|
| 1640 |
[dcl.attr]: dcl.md#dcl.attr
|
|
|
|
| 1641 |
[dcl.fct.default]: dcl.md#dcl.fct.default
|
| 1642 |
[dcl.fct.spec]: dcl.md#dcl.fct.spec
|
| 1643 |
[dcl.init]: dcl.md#dcl.init
|
| 1644 |
[dcl.link]: dcl.md#dcl.link
|
| 1645 |
[definitions]: #definitions
|
|
@@ -1700,10 +1761,11 @@ objects shall be placed in a valid but unspecified state.
|
|
| 1700 |
[nullablepointer.requirements]: #nullablepointer.requirements
|
| 1701 |
[numeric.requirements]: numerics.md#numeric.requirements
|
| 1702 |
[numerics]: numerics.md#numerics
|
| 1703 |
[objects.within.classes]: #objects.within.classes
|
| 1704 |
[organization]: #organization
|
|
|
|
| 1705 |
[over.match]: over.md#over.match
|
| 1706 |
[over.oper]: over.md#over.oper
|
| 1707 |
[protection.within.classes]: #protection.within.classes
|
| 1708 |
[re]: re.md#re
|
| 1709 |
[reentrancy]: #reentrancy
|
|
@@ -1836,11 +1898,11 @@ objects shall be placed in a valid but unspecified state.
|
|
| 1836 |
|
| 1837 |
[^20]: This is the same as the Standard C library.
|
| 1838 |
|
| 1839 |
[^21]: The only reliable way to declare an object or function signature
|
| 1840 |
from the Standard C library is by including the header that declares
|
| 1841 |
-
it, notwithstanding the latitude granted in 7.1.
|
| 1842 |
|
| 1843 |
[^22]: Any library code that instantiates other library templates must
|
| 1844 |
be prepared to work adequately with any user-supplied specialization
|
| 1845 |
that meets the minimum requirements of the Standard.
|
| 1846 |
|
|
|
|
| 191 |
a class member function ([[class.mfct]]) that accesses the state of an
|
| 192 |
object of the class but does not alter that state
|
| 193 |
Observer functions are specified as `const` member functions (
|
| 194 |
[[class.this]]).
|
| 195 |
|
| 196 |
+
#### 19 referenceable type <a id="defns.referenceable">[[defns.referenceable]]</a>
|
| 197 |
+
|
| 198 |
+
An object type, a function type that does not have cv-qualifiers or a
|
| 199 |
+
*ref-qualifier*, or a reference type. The term describes a type to which
|
| 200 |
+
a reference can be created, including reference types.
|
| 201 |
+
|
| 202 |
+
#### 20 replacement function <a id="defns.replacement">[[defns.replacement]]</a>
|
| 203 |
|
| 204 |
a *non-reserved function* whose definition is provided by a C++program
|
| 205 |
Only one definition for such a function is in effect for the duration of
|
| 206 |
the program’s execution, as the result of creating the program (
|
| 207 |
[[lex.phases]]) and resolving the definitions of all translation units (
|
| 208 |
[[basic.link]]).
|
| 209 |
|
| 210 |
+
#### 21 repositional stream <a id="defns.repositional.stream">[[defns.repositional.stream]]</a>
|
| 211 |
|
| 212 |
a stream (described in Clause [[input.output]]) that can seek to a
|
| 213 |
position that was previously encountered
|
| 214 |
|
| 215 |
+
#### 22 required behavior <a id="defns.required.behavior">[[defns.required.behavior]]</a>
|
| 216 |
|
| 217 |
a description of *replacement function* and *handler function* semantics
|
| 218 |
applicable to both the behavior provided by the implementation and the
|
| 219 |
behavior of any such function definition in the program
|
| 220 |
If such a function defined in a C++program fails to meet the required
|
| 221 |
behavior when it executes, the behavior is undefined.
|
| 222 |
|
| 223 |
+
#### 23 reserved function <a id="defns.reserved.function">[[defns.reserved.function]]</a>
|
| 224 |
|
| 225 |
a function, specified as part of the C++standard library, that must be
|
| 226 |
defined by the implementation
|
| 227 |
If a C++program provides a definition for any reserved function, the
|
| 228 |
results are undefined.
|
| 229 |
|
| 230 |
+
#### 24 stable algorithm <a id="defns.stable">[[defns.stable]]</a>
|
| 231 |
|
| 232 |
an algorithm that preserves, as appropriate to the particular algorithm,
|
| 233 |
the order of elements
|
| 234 |
Requirements for stable algorithms are given in [[algorithm.stable]].
|
| 235 |
|
| 236 |
+
#### 25 traits class <a id="defns.traits">[[defns.traits]]</a>
|
| 237 |
|
| 238 |
a class that encapsulates a set of types and functions necessary for
|
| 239 |
class templates and function templates to manipulate objects of types
|
| 240 |
for which they are instantiated
|
| 241 |
Traits classes defined in Clauses [[strings]], [[localization]] and
|
| 242 |
[[input.output]] are *character traits*, which provide the character
|
| 243 |
handling support needed by the string and iostream classes.
|
| 244 |
|
| 245 |
+
#### 26 unblock <a id="defns.unblock">[[defns.unblock]]</a>
|
| 246 |
|
| 247 |
place a thread in the unblocked state
|
| 248 |
|
| 249 |
+
#### 27 valid but unspecified state <a id="defns.valid">[[defns.valid]]</a>
|
| 250 |
|
| 251 |
an object state that is not specified except that the object’s
|
| 252 |
invariants are met and operations on the object behave as specified for
|
| 253 |
its type
|
| 254 |
If an object `x` of type `std::vector<int>` is in a valid but
|
|
|
|
| 322 |
valid terms of the types that satisfy the requirements. For every set of
|
| 323 |
well-defined expression requirements there is a table that specifies an
|
| 324 |
initial set of the valid expressions and their semantics. Any generic
|
| 325 |
algorithm (Clause [[algorithms]]) that uses the well-defined expression
|
| 326 |
requirements is described in terms of the valid expressions for its
|
| 327 |
+
template type parameters.
|
| 328 |
|
| 329 |
Template argument requirements are sometimes referenced by name. See
|
| 330 |
[[type.descriptions]].
|
| 331 |
|
| 332 |
In some cases the semantic requirements are presented as C++code. Such
|
|
|
|
| 501 |
X = X ^ Y; return X;
|
| 502 |
}
|
| 503 |
```
|
| 504 |
|
| 505 |
Here, the names *C0*, *C1*, etc. represent *bitmask elements* for this
|
| 506 |
+
particular bitmask type. All such elements have distinct, nonzero values
|
| 507 |
+
such that, for any pair *Ci* and *Cj* where *i* != *j*, *Ci* & *Ci* is
|
| 508 |
+
nonzero and *Ci* & *Cj* is zero. Additionally, the value 0 is used to
|
| 509 |
+
represent an *empty bitmask*, in which no bitmask elements are set.
|
| 510 |
|
| 511 |
The following terms apply to objects and values of bitmask types:
|
| 512 |
|
| 513 |
- To *set* a value *Y* in an object *X* is to evaluate the expression
|
| 514 |
+
*X* `|=` *Y*.
|
| 515 |
- To *clear* a value *Y* in an object *X* is to evaluate the expression
|
| 516 |
+
*X* `&= ~`*Y*.
|
| 517 |
+
- The value *Y* *is set* in the object *X* if the expression *X* `&` *Y*
|
| 518 |
is nonzero.
|
| 519 |
|
| 520 |
##### Character sequences <a id="character.seq">[[character.seq]]</a>
|
| 521 |
|
| 522 |
The C standard library makes widespread use of characters and character
|
|
|
|
| 645 |
#### Headers <a id="headers">[[headers]]</a>
|
| 646 |
|
| 647 |
Each element of the C++standard library is declared or defined (as
|
| 648 |
appropriate) in a *header*.[^16]
|
| 649 |
|
| 650 |
+
The C++standard library provides 53 *C++library headers*, as shown in
|
| 651 |
Table [[tab:cpp.library.headers]].
|
| 652 |
|
| 653 |
**Table: C++library headers** <a id="tab:cpp.library.headers">[tab:cpp.library.headers]</a>
|
| 654 |
|
| 655 |
| | | | | |
|
|
|
|
| 762 |
current definition of `NDEBUG`.[^20]
|
| 763 |
|
| 764 |
A translation unit shall include a header only outside of any external
|
| 765 |
declaration or definition, and shall include the header lexically before
|
| 766 |
the first reference in that translation unit to any of the entities
|
| 767 |
+
declared in that header. No diagnostic is required.
|
| 768 |
|
| 769 |
#### Linkage <a id="using.linkage">[[using.linkage]]</a>
|
| 770 |
|
| 771 |
Entities in the C++standard library have external linkage (
|
| 772 |
[[basic.link]]). Unless otherwise specified, objects and functions have
|
|
|
|
| 862 |
|
| 863 |
|
| 864 |
**Table: `Destructible` requirements** <a id="destructible">[destructible]</a>
|
| 865 |
|
| 866 |
| | |
|
| 867 |
+
| -------- | --------------------------------------------------------------------- |
|
| 868 |
+
| `u.~T()` | All resources owned by `u` are reclaimed, no exception is propagated. |
|
| 869 |
|
| 870 |
|
| 871 |
+
#### `Swappable` requirements <a id="swappable.requirements">[[swappable.requirements]]</a>
|
| 872 |
|
| 873 |
This subclause provides definitions for swappable types and expressions.
|
| 874 |
In these definitions, let `t` denote an expression of type `T`, and let
|
| 875 |
`u` denote an expression of type `U`.
|
| 876 |
|
|
|
|
| 904 |
|
| 905 |
An rvalue or lvalue `t` is *swappable* if and only if `t` is swappable
|
| 906 |
with any rvalue or lvalue, respectively, of type `T`.
|
| 907 |
|
| 908 |
A type `X` satisfying any of the iterator requirements (
|
| 909 |
+
[[iterator.requirements]]) satisfies the requirements of
|
| 910 |
+
`ValueSwappable` if, for any dereferenceable object `x` of type `X`,
|
| 911 |
+
`*x` is swappable.
|
| 912 |
|
| 913 |
User code can ensure that the evaluation of `swap` calls is performed in
|
| 914 |
an appropriate context under the various conditions as follows:
|
| 915 |
|
| 916 |
``` cpp
|
|
|
|
| 1015 |
(possibly `const`) `Key`.
|
| 1016 |
|
| 1017 |
**Table: `Hash` requirements** <a id="hash">[hash]</a>
|
| 1018 |
|
| 1019 |
| | | |
|
| 1020 |
+
| ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| 1021 |
+
| `h(k)` | `size_t` | The value returned shall depend only on the argument `k` for the duration of the program. \enternote Thus all evaluations of the expression `h(k)` with the same value for `k` yield the same result for a given execution of the program. \exitnote \enternote For two different values `t1` and `t2`, the probability that `h(t1)` and `h(t2)` compare equal should be very small, approaching `1.0 / numeric_limits<size_t>::max()`. \exitnote |
|
| 1022 |
| `h(u)` | `size_t` | Shall not modify `u`. |
|
| 1023 |
|
| 1024 |
|
| 1025 |
#### Allocator requirements <a id="allocator.requirements">[[allocator.requirements]]</a>
|
| 1026 |
|
|
|
|
| 1060 |
`rebind` member template, the standard `allocator_traits` template uses
|
| 1061 |
`SomeAllocator<U, Args>` in place of `Allocator::{}rebind<U>::other` by
|
| 1062 |
default. For allocator types that are not template instantiations of the
|
| 1063 |
above form, no default is provided.
|
| 1064 |
|
| 1065 |
+
An allocator type `X` shall satisfy the requirements of
|
| 1066 |
+
`CopyConstructible` ([[utility.arg.requirements]]). The `X::pointer`,
|
| 1067 |
+
`X::const_pointer`, `X::void_pointer`, and `X::const_void_pointer` types
|
| 1068 |
+
shall satisfy the requirements of `NullablePointer` (
|
| 1069 |
+
[[nullablepointer.requirements]]). No constructor, comparison operator,
|
| 1070 |
+
copy operation, move operation, or swap operation on these types shall
|
| 1071 |
+
exit via an exception. `X::pointer` and `X::const_pointer` shall also
|
| 1072 |
+
satisfy the requirements for a random access iterator (
|
| 1073 |
+
[[iterator.requirements]]).
|
| 1074 |
+
|
| 1075 |
+
Let `x1` and `x2` denote objects of (possibly different) types
|
| 1076 |
+
`X::void_pointer`, `X::const_void_pointer`, `X::pointer`, or
|
| 1077 |
+
`X::const_pointer`. Then, `x1` and `x2` are *equivalently-valued*
|
| 1078 |
+
pointer values, if and only if both `x1` and `x2` can be explicitly
|
| 1079 |
+
converted to the two corresponding objects `px1` and `px2` of type
|
| 1080 |
+
`X::const_pointer`, using a sequence of `static_cast`s using only these
|
| 1081 |
+
four types, and the expression `px1 == px2` evaluates to `true`.
|
| 1082 |
+
|
| 1083 |
+
Let `w1` and `w2` denote objects of type `X::void_pointer`. Then for the
|
| 1084 |
+
expressions
|
| 1085 |
+
|
| 1086 |
+
``` cpp
|
| 1087 |
+
w1 == w2
|
| 1088 |
+
w1 != w2
|
| 1089 |
+
```
|
| 1090 |
+
|
| 1091 |
+
either or both objects may be replaced by an equivalently-valued object
|
| 1092 |
+
of type `X::const_void_pointer` with no change in semantics.
|
| 1093 |
+
|
| 1094 |
+
Let `p1` and `p2` denote objects of type `X::pointer`. Then for the
|
| 1095 |
+
expressions
|
| 1096 |
+
|
| 1097 |
+
``` cpp
|
| 1098 |
+
p1 == p2
|
| 1099 |
+
p1 != p2
|
| 1100 |
+
p1 < p2
|
| 1101 |
+
p1 <= p2
|
| 1102 |
+
p1 >= p2
|
| 1103 |
+
p1 > p2
|
| 1104 |
+
p1 - p2
|
| 1105 |
+
```
|
| 1106 |
+
|
| 1107 |
+
either or both objects may be replaced by an equivalently-valued object
|
| 1108 |
+
of type `X::const_pointer` with no change in semantics.
|
| 1109 |
|
| 1110 |
An allocator may constrain the types on which it can be instantiated and
|
| 1111 |
the arguments for which its `construct` member may be called. If a type
|
| 1112 |
cannot be used with a particular allocator, the allocator class or the
|
| 1113 |
call to `construct` may fail to instantiate.
|
|
|
|
| 1125 |
template <class T> SimpleAllocator(const SimpleAllocator<T>& other);
|
| 1126 |
|
| 1127 |
Tp* allocate(std::size_t n);
|
| 1128 |
void deallocate(Tp* p, std::size_t n);
|
| 1129 |
};
|
| 1130 |
+
|
| 1131 |
+
template <class T, class U>
|
| 1132 |
+
bool operator==(const SimpleAllocator<T>&, const SimpleAllocator<U>&);
|
| 1133 |
+
template <class T, class U>
|
| 1134 |
+
bool operator!=(const SimpleAllocator<T>&, const SimpleAllocator<U>&);
|
| 1135 |
```
|
| 1136 |
|
| 1137 |
If the alignment associated with a specific over-aligned type is not
|
| 1138 |
supported by an allocator, instantiation of the allocator for that type
|
| 1139 |
may fail. The allocator also may silently ignore the requested
|
|
|
|
| 1273 |
describe the behavior of numerous functions defined by the C++standard
|
| 1274 |
library. Under some circumstances, however, certain of these function
|
| 1275 |
descriptions also apply to replacement functions defined in the
|
| 1276 |
program ([[definitions]]).
|
| 1277 |
|
| 1278 |
+
A C++program may provide the definition for any of twelve dynamic memory
|
| 1279 |
allocation function signatures declared in header `<new>` (
|
| 1280 |
[[basic.stc.dynamic]], [[support.dynamic]]):
|
| 1281 |
|
| 1282 |
- `operator new(std::size_t)`
|
| 1283 |
- `operator new(std::size_t, const std::nothrow_t&)`
|
|
|
|
| 1285 |
- `operator new[](std::size_t, const std::nothrow_t&)`
|
| 1286 |
- `operator delete(void*)`
|
| 1287 |
- `operator delete(void*, const std::nothrow_t&)`
|
| 1288 |
- `operator delete[](void*)`
|
| 1289 |
- `operator delete[](void*, const std::nothrow_t&)`
|
| 1290 |
+
- `operator delete(void*, std::size_t)`
|
| 1291 |
+
- `operator delete(void*, std::size_t, const std::nothrow_t&)`
|
| 1292 |
+
- `operator delete[](void*, std::size_t)`
|
| 1293 |
+
- `operator delete[](void*, std::size_t, const std::nothrow_t&)`
|
| 1294 |
|
| 1295 |
The program’s definitions are used instead of the default versions
|
| 1296 |
supplied by the implementation ([[support.dynamic]]). Such replacement
|
| 1297 |
occurs prior to program startup ([[basic.def.odr]], [[basic.start]]).
|
| 1298 |
The program’s definitions shall not be specified as `inline`. No
|
|
|
|
| 1463 |
Unless otherwise specified, global and non-member functions in the
|
| 1464 |
standard library shall not use functions from another namespace which
|
| 1465 |
are found through *argument-dependent name lookup* (
|
| 1466 |
[[basic.lookup.argdep]]). The phrase “unless otherwise specified” is
|
| 1467 |
intended to allow argument-dependent lookup in cases like that of
|
| 1468 |
+
`ostream_iterator::operator=` ([[ostream.iterator.ops]]):
|
| 1469 |
+
|
| 1470 |
+
*Effects:*
|
| 1471 |
|
| 1472 |
``` cpp
|
| 1473 |
*out_stream << value;
|
| 1474 |
if (delim != 0)
|
| 1475 |
*out_stream << delim;
|
| 1476 |
+
return *this;
|
| 1477 |
```
|
| 1478 |
|
| 1479 |
#### Member functions <a id="member.functions">[[member.functions]]</a>
|
| 1480 |
|
| 1481 |
It is unspecified whether any member functions in the C++standard
|
|
|
|
| 1495 |
library behaves as if the implementation declares no additional member
|
| 1496 |
function signatures.[^29]
|
| 1497 |
|
| 1498 |
#### `constexpr` functions and constructors <a id="constexpr.functions">[[constexpr.functions]]</a>
|
| 1499 |
|
| 1500 |
+
This standard explicitly requires that certain standard library
|
| 1501 |
+
functions are `constexpr` ([[dcl.constexpr]]). An implementation shall
|
| 1502 |
+
not declare any standard library function signature as `constexpr`
|
| 1503 |
+
except for those where it is explicitly required. Within any header that
|
| 1504 |
+
provides any non-defining declarations of `constexpr` functions or
|
| 1505 |
+
constructors an implementation shall provide corresponding definitions.
|
| 1506 |
|
| 1507 |
#### Requirements for stable algorithms <a id="algorithm.stable">[[algorithm.stable]]</a>
|
| 1508 |
|
| 1509 |
When the requirements for an algorithm state that it is “stable” without
|
| 1510 |
further elaboration, it means:
|
| 1511 |
|
| 1512 |
- For the *sort* algorithms the relative order of equivalent elements is
|
| 1513 |
preserved.
|
| 1514 |
+
- For the *remove* and *copy* algorithms the relative order of the
|
| 1515 |
+
elements that are not removed is preserved.
|
| 1516 |
- For the *merge* algorithms, for equivalent elements in the original
|
| 1517 |
+
two ranges, the elements from the first range (preserving their
|
| 1518 |
+
original order) precede the elements from the second range (preserving
|
| 1519 |
+
their original order).
|
| 1520 |
|
| 1521 |
#### Reentrancy <a id="reentrancy">[[reentrancy]]</a>
|
| 1522 |
|
| 1523 |
Except where explicitly specified in this standard, it is
|
| 1524 |
*implementation-defined* which functions in the Standard C++ library may
|
|
|
|
| 1696 |
[conventions]: #conventions
|
| 1697 |
[cpp.include]: cpp.md#cpp.include
|
| 1698 |
[cstdint]: language.md#cstdint
|
| 1699 |
[dcl.array]: dcl.md#dcl.array
|
| 1700 |
[dcl.attr]: dcl.md#dcl.attr
|
| 1701 |
+
[dcl.constexpr]: dcl.md#dcl.constexpr
|
| 1702 |
[dcl.fct.default]: dcl.md#dcl.fct.default
|
| 1703 |
[dcl.fct.spec]: dcl.md#dcl.fct.spec
|
| 1704 |
[dcl.init]: dcl.md#dcl.init
|
| 1705 |
[dcl.link]: dcl.md#dcl.link
|
| 1706 |
[definitions]: #definitions
|
|
|
|
| 1761 |
[nullablepointer.requirements]: #nullablepointer.requirements
|
| 1762 |
[numeric.requirements]: numerics.md#numeric.requirements
|
| 1763 |
[numerics]: numerics.md#numerics
|
| 1764 |
[objects.within.classes]: #objects.within.classes
|
| 1765 |
[organization]: #organization
|
| 1766 |
+
[ostream.iterator.ops]: iterators.md#ostream.iterator.ops
|
| 1767 |
[over.match]: over.md#over.match
|
| 1768 |
[over.oper]: over.md#over.oper
|
| 1769 |
[protection.within.classes]: #protection.within.classes
|
| 1770 |
[re]: re.md#re
|
| 1771 |
[reentrancy]: #reentrancy
|
|
|
|
| 1898 |
|
| 1899 |
[^20]: This is the same as the Standard C library.
|
| 1900 |
|
| 1901 |
[^21]: The only reliable way to declare an object or function signature
|
| 1902 |
from the Standard C library is by including the header that declares
|
| 1903 |
+
it, notwithstanding the latitude granted in 7.1.4 of the C Standard.
|
| 1904 |
|
| 1905 |
[^22]: Any library code that instantiates other library templates must
|
| 1906 |
be prepared to work adequately with any user-supplied specialization
|
| 1907 |
that meets the minimum requirements of the Standard.
|
| 1908 |
|