- tmp/tmpex8b6l_r/{from.md → to.md} +0 -2851
tmp/tmpex8b6l_r/{from.md → to.md}
RENAMED
|
@@ -1,2851 +0,0 @@
|
|
| 1 |
-
# Language support library <a id="language.support">[[language.support]]</a>
|
| 2 |
-
|
| 3 |
-
## General <a id="support.general">[[support.general]]</a>
|
| 4 |
-
|
| 5 |
-
This Clause describes the function signatures that are called
|
| 6 |
-
implicitly, and the types of objects generated implicitly, during the
|
| 7 |
-
execution of some C++programs. It also describes the headers that
|
| 8 |
-
declare these function signatures and define any related types.
|
| 9 |
-
|
| 10 |
-
The following subclauses describe common type definitions used
|
| 11 |
-
throughout the library, characteristics of the predefined types,
|
| 12 |
-
functions supporting start and termination of a C++program, support for
|
| 13 |
-
dynamic memory management, support for dynamic type identification,
|
| 14 |
-
support for exception processing, support for initializer lists, and
|
| 15 |
-
other runtime support, as summarized in Table
|
| 16 |
-
[[tab:lang.sup.lib.summary]].
|
| 17 |
-
|
| 18 |
-
**Table: Language support library summary** <a id="tab:lang.sup.lib.summary">[tab:lang.sup.lib.summary]</a>
|
| 19 |
-
|
| 20 |
-
| Subclause | | Header |
|
| 21 |
-
| ---------------------- | ------------------------- | -------------------- |
|
| 22 |
-
| [[support.types]] | Common definitions | `<cstddef>` |
|
| 23 |
-
| | | `<cstdlib>` |
|
| 24 |
-
| [[support.limits]] | Implementation properties | `<limits>` |
|
| 25 |
-
| | | `<climits>` |
|
| 26 |
-
| | | `<cfloat>` |
|
| 27 |
-
| [[cstdint]] | Integer types | `<cstdint>` |
|
| 28 |
-
| [[support.start.term]] | Start and termination | `<cstdlib>` |
|
| 29 |
-
| [[support.dynamic]] | Dynamic memory management | `<new>` |
|
| 30 |
-
| [[support.rtti]] | Type identification | `<typeinfo>` |
|
| 31 |
-
| [[support.exception]] | Exception handling | `<exception>` |
|
| 32 |
-
| [[support.initlist]] | Initializer lists | `<initializer_list>` |
|
| 33 |
-
| [[support.runtime]] | Other runtime support | `<csignal>` |
|
| 34 |
-
| | | `<csetjmp>` |
|
| 35 |
-
| | | `<cstdarg>` |
|
| 36 |
-
| | | `<cstdlib>` |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
## Common definitions <a id="support.types">[[support.types]]</a>
|
| 40 |
-
|
| 41 |
-
### Header `<cstddef>` synopsis <a id="cstddef.syn">[[cstddef.syn]]</a>
|
| 42 |
-
|
| 43 |
-
``` cpp
|
| 44 |
-
namespace std {
|
| 45 |
-
using ptrdiff_t = see below;
|
| 46 |
-
using size_t = see below;
|
| 47 |
-
using max_align_t = see below;
|
| 48 |
-
using nullptr_t = decltype(nullptr);
|
| 49 |
-
|
| 50 |
-
enum class byte : unsigned char {};
|
| 51 |
-
|
| 52 |
-
// [support.types.byteops], byte type operations
|
| 53 |
-
template <class IntType>
|
| 54 |
-
constexpr byte& operator<<=(byte& b, IntType shift) noexcept;
|
| 55 |
-
template <class IntType>
|
| 56 |
-
constexpr byte operator<<(byte b, IntType shift) noexcept;
|
| 57 |
-
template <class IntType>
|
| 58 |
-
constexpr byte& operator>>=(byte& b, IntType shift) noexcept;
|
| 59 |
-
template <class IntType>
|
| 60 |
-
constexpr byte operator>>(byte b, IntType shift) noexcept;
|
| 61 |
-
constexpr byte& operator|=(byte& l, byte r) noexcept;
|
| 62 |
-
constexpr byte operator|(byte l, byte r) noexcept;
|
| 63 |
-
constexpr byte& operator&=(byte& l, byte r) noexcept;
|
| 64 |
-
constexpr byte operator&(byte l, byte r) noexcept;
|
| 65 |
-
constexpr byte& operator^=(byte& l, byte r) noexcept;
|
| 66 |
-
constexpr byte operator^(byte l, byte r) noexcept;
|
| 67 |
-
constexpr byte operator~(byte b) noexcept;
|
| 68 |
-
template <class IntType>
|
| 69 |
-
constexpr IntType to_integer(byte b) noexcept;
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
#define NULL see below
|
| 73 |
-
#define offsetof(P, D) see below
|
| 74 |
-
```
|
| 75 |
-
|
| 76 |
-
The contents and meaning of the header `<cstddef>` are the same as the C
|
| 77 |
-
standard library header `<stddef.h>`, except that it does not declare
|
| 78 |
-
the type `wchar_t`, that it also declares the type `byte` and its
|
| 79 |
-
associated operations ([[support.types.byteops]]), and as noted in
|
| 80 |
-
[[support.types.nullptr]] and [[support.types.layout]].
|
| 81 |
-
|
| 82 |
-
ISO C 7.19
|
| 83 |
-
|
| 84 |
-
### Header `<cstdlib>` synopsis <a id="cstdlib.syn">[[cstdlib.syn]]</a>
|
| 85 |
-
|
| 86 |
-
``` cpp
|
| 87 |
-
namespace std {
|
| 88 |
-
using size_t = see below;
|
| 89 |
-
using div_t = see below;
|
| 90 |
-
using ldiv_t = see below;
|
| 91 |
-
using lldiv_t = see below;
|
| 92 |
-
}
|
| 93 |
-
|
| 94 |
-
#define NULL see below
|
| 95 |
-
#define EXIT_FAILURE see below
|
| 96 |
-
#define EXIT_SUCCESS see below
|
| 97 |
-
#define RAND_MAX see below
|
| 98 |
-
#define MB_CUR_MAX see below
|
| 99 |
-
|
| 100 |
-
namespace std {
|
| 101 |
-
// Exposition-only function type aliases
|
| 102 |
-
extern "C" using c-atexit-handler = void(); // exposition only
|
| 103 |
-
extern "C++" using atexit-handler = void(); // exposition only
|
| 104 |
-
extern "C" using c-compare-pred = int(const void*, const void*); // exposition only
|
| 105 |
-
extern "C++" using compare-pred = int(const void*, const void*); // exposition only
|
| 106 |
-
|
| 107 |
-
// [support.start.term], start and termination
|
| 108 |
-
[[noreturn]] void abort() noexcept;
|
| 109 |
-
int atexit(c-atexit-handler* func) noexcept;
|
| 110 |
-
int atexit(atexit-handler* func) noexcept;
|
| 111 |
-
int at_quick_exit(c-atexit-handler* func) noexcept;
|
| 112 |
-
int at_quick_exit(atexit-handler* func) noexcept;
|
| 113 |
-
[[noreturn]] void exit(int status);
|
| 114 |
-
[[noreturn]] void _Exit(int status) noexcept;
|
| 115 |
-
[[noreturn]] void quick_exit(int status) noexcept;
|
| 116 |
-
|
| 117 |
-
char* getenv(const char* name);
|
| 118 |
-
int system(const char* string);
|
| 119 |
-
|
| 120 |
-
// [c.malloc], C library memory allocation
|
| 121 |
-
void* aligned_alloc(size_t alignment, size_t size);
|
| 122 |
-
void* calloc(size_t nmemb, size_t size);
|
| 123 |
-
void free(void* ptr);
|
| 124 |
-
void* malloc(size_t size);
|
| 125 |
-
void* realloc(void* ptr, size_t size);
|
| 126 |
-
|
| 127 |
-
double atof(const char* nptr);
|
| 128 |
-
int atoi(const char* nptr);
|
| 129 |
-
long int atol(const char* nptr);
|
| 130 |
-
long long int atoll(const char* nptr);
|
| 131 |
-
double strtod(const char* nptr, char** endptr);
|
| 132 |
-
float strtof(const char* nptr, char** endptr);
|
| 133 |
-
long double strtold(const char* nptr, char** endptr);
|
| 134 |
-
long int strtol(const char* nptr, char** endptr, int base);
|
| 135 |
-
long long int strtoll(const char* nptr, char** endptr, int base);
|
| 136 |
-
unsigned long int strtoul(const char* nptr, char** endptr, int base);
|
| 137 |
-
unsigned long long int strtoull(const char* nptr, char** endptr, int base);
|
| 138 |
-
|
| 139 |
-
// [c.mb.wcs], multibyte / wide string and character conversion functions
|
| 140 |
-
int mblen(const char* s, size_t n);
|
| 141 |
-
int mbtowc(wchar_t* pwc, const char* s, size_t n);
|
| 142 |
-
int wctomb(char* s, wchar_t wchar);
|
| 143 |
-
size_t mbstowcs(wchar_t* pwcs, const char* s, size_t n);
|
| 144 |
-
size_t wcstombs(char* s, const wchar_t* pwcs, size_t n);
|
| 145 |
-
|
| 146 |
-
// [alg.c.library], C standard library algorithms
|
| 147 |
-
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
|
| 148 |
-
c-compare-pred* compar);
|
| 149 |
-
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
|
| 150 |
-
compare-pred* compar);
|
| 151 |
-
void qsort(void* base, size_t nmemb, size_t size, c-compare-pred* compar);
|
| 152 |
-
void qsort(void* base, size_t nmemb, size_t size, compare-pred* compar);
|
| 153 |
-
|
| 154 |
-
// [c.math.rand], low-quality random number generation
|
| 155 |
-
int rand();
|
| 156 |
-
void srand(unsigned int seed);
|
| 157 |
-
|
| 158 |
-
// [c.math.abs], absolute values
|
| 159 |
-
int abs(int j);
|
| 160 |
-
long int abs(long int j);
|
| 161 |
-
long long int abs(long long int j);
|
| 162 |
-
float abs(float j);
|
| 163 |
-
double abs(double j);
|
| 164 |
-
long double abs(long double j);
|
| 165 |
-
|
| 166 |
-
long int labs(long int j);
|
| 167 |
-
long long int llabs(long long int j);
|
| 168 |
-
|
| 169 |
-
div_t div(int numer, int denom);
|
| 170 |
-
ldiv_t div(long int numer, long int denom); // see [library.c]
|
| 171 |
-
lldiv_t div(long long int numer, long long int denom); // see [library.c]
|
| 172 |
-
ldiv_t ldiv(long int numer, long int denom);
|
| 173 |
-
lldiv_t lldiv(long long int numer, long long int denom);
|
| 174 |
-
}
|
| 175 |
-
```
|
| 176 |
-
|
| 177 |
-
The contents and meaning of the header `<cstdlib>` are the same as the C
|
| 178 |
-
standard library header `<stdlib.h>`, except that it does not declare
|
| 179 |
-
the type `wchar_t`, and except as noted in [[support.types.nullptr]],
|
| 180 |
-
[[support.types.layout]], [[support.start.term]], [[c.malloc]],
|
| 181 |
-
[[c.mb.wcs]], [[alg.c.library]], [[c.math.rand]], and [[c.math.abs]].
|
| 182 |
-
|
| 183 |
-
[*Note 1*: Several functions have additional overloads in this
|
| 184 |
-
International Standard, but they have the same behavior as in the C
|
| 185 |
-
standard library ([[library.c]]). — *end note*]
|
| 186 |
-
|
| 187 |
-
ISO C 7.22
|
| 188 |
-
|
| 189 |
-
### Null pointers <a id="support.types.nullptr">[[support.types.nullptr]]</a>
|
| 190 |
-
|
| 191 |
-
The type `nullptr_t` is a synonym for the type of a `nullptr`
|
| 192 |
-
expression, and it has the characteristics described in
|
| 193 |
-
[[basic.fundamental]] and [[conv.ptr]].
|
| 194 |
-
|
| 195 |
-
[*Note 1*: Although `nullptr`’s address cannot be taken, the address of
|
| 196 |
-
another `nullptr_t` object that is an lvalue can be
|
| 197 |
-
taken. — *end note*]
|
| 198 |
-
|
| 199 |
-
The macro `NULL` is an *implementation-defined* null pointer constant.
|
| 200 |
-
[^1]
|
| 201 |
-
|
| 202 |
-
### Sizes, alignments, and offsets <a id="support.types.layout">[[support.types.layout]]</a>
|
| 203 |
-
|
| 204 |
-
The macro `offsetof(type, member-designator)` has the same semantics as
|
| 205 |
-
the corresponding macro in the C standard library header `<stddef.h>`,
|
| 206 |
-
but accepts a restricted set of `type` arguments in this International
|
| 207 |
-
Standard. Use of the `offsetof` macro with a `type` other than a
|
| 208 |
-
standard-layout class (Clause [[class]]) is
|
| 209 |
-
conditionally-supported.[^2] The expression
|
| 210 |
-
`offsetof(type, member-designator)` is never type-dependent (
|
| 211 |
-
[[temp.dep.expr]]) and it is value-dependent ([[temp.dep.constexpr]])
|
| 212 |
-
if and only if `type` is dependent. The result of applying the
|
| 213 |
-
`offsetof` macro to a static data member or a function member is
|
| 214 |
-
undefined. No operation invoked by the `offsetof` macro shall throw an
|
| 215 |
-
exception and `noexcept(offsetof(type, member-designator))` shall be
|
| 216 |
-
`true`.
|
| 217 |
-
|
| 218 |
-
The type `ptrdiff_t` is an *implementation-defined* signed integer type
|
| 219 |
-
that can hold the difference of two subscripts in an array object, as
|
| 220 |
-
described in [[expr.add]].
|
| 221 |
-
|
| 222 |
-
The type `size_t` is an *implementation-defined* unsigned integer type
|
| 223 |
-
that is large enough to contain the size in bytes of any object.
|
| 224 |
-
|
| 225 |
-
[*Note 1*: It is recommended that implementations choose types for
|
| 226 |
-
`ptrdiff_t` and `size_t` whose integer conversion ranks ([[conv.rank]])
|
| 227 |
-
are no greater than that of `signed long int` unless a larger size is
|
| 228 |
-
necessary to contain all the possible values. — *end note*]
|
| 229 |
-
|
| 230 |
-
The type `max_align_t` is a POD type whose alignment requirement is at
|
| 231 |
-
least as great as that of every scalar type, and whose alignment
|
| 232 |
-
requirement is supported in every context.
|
| 233 |
-
|
| 234 |
-
Alignment ([[basic.align]]), Sizeof ([[expr.sizeof]]), Additive
|
| 235 |
-
operators ([[expr.add]]), Free store ([[class.free]]), and ISO C 7.19.
|
| 236 |
-
|
| 237 |
-
### `byte` type operations <a id="support.types.byteops">[[support.types.byteops]]</a>
|
| 238 |
-
|
| 239 |
-
``` cpp
|
| 240 |
-
template <class IntType>
|
| 241 |
-
constexpr byte& operator<<=(byte& b, IntType shift) noexcept;
|
| 242 |
-
```
|
| 243 |
-
|
| 244 |
-
*Remarks:* This function shall not participate in overload resolution
|
| 245 |
-
unless `is_integral_v<IntType>` is `true`.
|
| 246 |
-
|
| 247 |
-
*Effects:* Equivalent to:
|
| 248 |
-
`return b = byte(static_cast<unsigned char>(b) << shift);`
|
| 249 |
-
|
| 250 |
-
``` cpp
|
| 251 |
-
template <class IntType>
|
| 252 |
-
constexpr byte operator<<(byte b, IntType shift) noexcept;
|
| 253 |
-
```
|
| 254 |
-
|
| 255 |
-
*Remarks:* This function shall not participate in overload resolution
|
| 256 |
-
unless `is_integral_v<IntType>` is `true`.
|
| 257 |
-
|
| 258 |
-
*Effects:* Equivalent to:
|
| 259 |
-
`return byte(static_cast<unsigned char>(b) << shift);`
|
| 260 |
-
|
| 261 |
-
``` cpp
|
| 262 |
-
template <class IntType>
|
| 263 |
-
constexpr byte& operator>>=(byte& b, IntType shift) noexcept;
|
| 264 |
-
```
|
| 265 |
-
|
| 266 |
-
*Remarks:* This function shall not participate in overload resolution
|
| 267 |
-
unless `is_integral_v<IntType>` is `true`.
|
| 268 |
-
|
| 269 |
-
*Effects:* Equivalent to:
|
| 270 |
-
`return b = byte(static_cast<unsigned char>(b) >> shift);`
|
| 271 |
-
|
| 272 |
-
``` cpp
|
| 273 |
-
template <class IntType>
|
| 274 |
-
constexpr byte operator>>(byte b, IntType shift) noexcept;
|
| 275 |
-
```
|
| 276 |
-
|
| 277 |
-
*Remarks:* This function shall not participate in overload resolution
|
| 278 |
-
unless `is_integral_v<IntType>` is `true`.
|
| 279 |
-
|
| 280 |
-
*Effects:* Equivalent to:
|
| 281 |
-
`return byte(static_cast<unsigned char>(b) >> shift);`
|
| 282 |
-
|
| 283 |
-
``` cpp
|
| 284 |
-
constexpr byte& operator|=(byte& l, byte r) noexcept;
|
| 285 |
-
```
|
| 286 |
-
|
| 287 |
-
*Effects:* Equivalent to:
|
| 288 |
-
|
| 289 |
-
``` cpp
|
| 290 |
-
return l = byte(static_cast<unsigned char>(l) | static_cast<unsigned char>(r));
|
| 291 |
-
```
|
| 292 |
-
|
| 293 |
-
``` cpp
|
| 294 |
-
constexpr byte operator|(byte l, byte r) noexcept;
|
| 295 |
-
```
|
| 296 |
-
|
| 297 |
-
*Effects:* Equivalent to:
|
| 298 |
-
|
| 299 |
-
``` cpp
|
| 300 |
-
return byte(static_cast<unsigned char>(l) | static_cast<unsigned char>(r));
|
| 301 |
-
```
|
| 302 |
-
|
| 303 |
-
``` cpp
|
| 304 |
-
constexpr byte& operator&=(byte& l, byte r) noexcept;
|
| 305 |
-
```
|
| 306 |
-
|
| 307 |
-
*Effects:* Equivalent to:
|
| 308 |
-
|
| 309 |
-
``` cpp
|
| 310 |
-
return l = byte(static_cast<unsigned char>(l) & static_cast<unsigned char>(r));
|
| 311 |
-
```
|
| 312 |
-
|
| 313 |
-
``` cpp
|
| 314 |
-
constexpr byte operator&(byte l, byte r) noexcept;
|
| 315 |
-
```
|
| 316 |
-
|
| 317 |
-
*Effects:* Equivalent to:
|
| 318 |
-
|
| 319 |
-
``` cpp
|
| 320 |
-
return byte(static_cast<unsigned char>(l) & static_cast<unsigned char>(r));
|
| 321 |
-
```
|
| 322 |
-
|
| 323 |
-
``` cpp
|
| 324 |
-
constexpr byte& operator^=(byte& l, byte r) noexcept;
|
| 325 |
-
```
|
| 326 |
-
|
| 327 |
-
*Effects:* Equivalent to:
|
| 328 |
-
|
| 329 |
-
``` cpp
|
| 330 |
-
return l = byte(static_cast<unsigned char>(l) ^ static_cast<unsigned char>(r));
|
| 331 |
-
```
|
| 332 |
-
|
| 333 |
-
``` cpp
|
| 334 |
-
constexpr byte operator^(byte l, byte r) noexcept;
|
| 335 |
-
```
|
| 336 |
-
|
| 337 |
-
*Effects:* Equivalent to:
|
| 338 |
-
|
| 339 |
-
``` cpp
|
| 340 |
-
return byte(static_cast<unsigned char>(l) ^ static_cast<unsigned char>(r));
|
| 341 |
-
```
|
| 342 |
-
|
| 343 |
-
``` cpp
|
| 344 |
-
constexpr byte operator~(byte b) noexcept;
|
| 345 |
-
```
|
| 346 |
-
|
| 347 |
-
*Effects:* Equivalent to: `return byte(s̃tatic_cast<unsigned char>(b));`
|
| 348 |
-
|
| 349 |
-
``` cpp
|
| 350 |
-
template <class IntType>
|
| 351 |
-
constexpr IntType to_integer(byte b) noexcept;
|
| 352 |
-
```
|
| 353 |
-
|
| 354 |
-
*Remarks:* This function shall not participate in overload resolution
|
| 355 |
-
unless `is_integral_v<IntType>` is `true`.
|
| 356 |
-
|
| 357 |
-
*Effects:* Equivalent to: `return IntType(b);`
|
| 358 |
-
|
| 359 |
-
## Implementation properties <a id="support.limits">[[support.limits]]</a>
|
| 360 |
-
|
| 361 |
-
### General <a id="support.limits.general">[[support.limits.general]]</a>
|
| 362 |
-
|
| 363 |
-
The headers `<limits>` ([[limits.syn]]), `<climits>` (
|
| 364 |
-
[[climits.syn]]), and `<cfloat>` ([[cfloat.syn]]) supply
|
| 365 |
-
characteristics of implementation-dependent arithmetic types (
|
| 366 |
-
[[basic.fundamental]]).
|
| 367 |
-
|
| 368 |
-
### Header `<limits>` synopsis <a id="limits.syn">[[limits.syn]]</a>
|
| 369 |
-
|
| 370 |
-
``` cpp
|
| 371 |
-
namespace std {
|
| 372 |
-
// [fp.style], floating-point type properties
|
| 373 |
-
enum float_round_style;
|
| 374 |
-
enum float_denorm_style;
|
| 375 |
-
|
| 376 |
-
// [numeric.limits], class template numeric_limits
|
| 377 |
-
template<class T> class numeric_limits;
|
| 378 |
-
|
| 379 |
-
template<> class numeric_limits<bool>;
|
| 380 |
-
|
| 381 |
-
template<> class numeric_limits<char>;
|
| 382 |
-
template<> class numeric_limits<signed char>;
|
| 383 |
-
template<> class numeric_limits<unsigned char>;
|
| 384 |
-
template<> class numeric_limits<char16_t>;
|
| 385 |
-
template<> class numeric_limits<char32_t>;
|
| 386 |
-
template<> class numeric_limits<wchar_t>;
|
| 387 |
-
|
| 388 |
-
template<> class numeric_limits<short>;
|
| 389 |
-
template<> class numeric_limits<int>;
|
| 390 |
-
template<> class numeric_limits<long>;
|
| 391 |
-
template<> class numeric_limits<long long>;
|
| 392 |
-
template<> class numeric_limits<unsigned short>;
|
| 393 |
-
template<> class numeric_limits<unsigned int>;
|
| 394 |
-
template<> class numeric_limits<unsigned long>;
|
| 395 |
-
template<> class numeric_limits<unsigned long long>;
|
| 396 |
-
|
| 397 |
-
template<> class numeric_limits<float>;
|
| 398 |
-
template<> class numeric_limits<double>;
|
| 399 |
-
template<> class numeric_limits<long double>;
|
| 400 |
-
}
|
| 401 |
-
```
|
| 402 |
-
|
| 403 |
-
### Floating-point type properties <a id="fp.style">[[fp.style]]</a>
|
| 404 |
-
|
| 405 |
-
#### Type `float_round_style` <a id="round.style">[[round.style]]</a>
|
| 406 |
-
|
| 407 |
-
``` cpp
|
| 408 |
-
namespace std {
|
| 409 |
-
enum float_round_style {
|
| 410 |
-
round_indeterminate = -1,
|
| 411 |
-
round_toward_zero = 0,
|
| 412 |
-
round_to_nearest = 1,
|
| 413 |
-
round_toward_infinity = 2,
|
| 414 |
-
round_toward_neg_infinity = 3
|
| 415 |
-
};
|
| 416 |
-
}
|
| 417 |
-
```
|
| 418 |
-
|
| 419 |
-
The rounding mode for floating-point arithmetic is characterized by the
|
| 420 |
-
values:
|
| 421 |
-
|
| 422 |
-
- `round_indeterminate` if the rounding style is indeterminable
|
| 423 |
-
- `round_toward_zero` if the rounding style is toward zero
|
| 424 |
-
- `round_to_nearest` if the rounding style is to the nearest
|
| 425 |
-
representable value
|
| 426 |
-
- `round_toward_infinity` if the rounding style is toward infinity
|
| 427 |
-
- `round_toward_neg_infinity` if the rounding style is toward negative
|
| 428 |
-
infinity
|
| 429 |
-
|
| 430 |
-
#### Type `float_denorm_style` <a id="denorm.style">[[denorm.style]]</a>
|
| 431 |
-
|
| 432 |
-
``` cpp
|
| 433 |
-
namespace std {
|
| 434 |
-
enum float_denorm_style {
|
| 435 |
-
denorm_indeterminate = -1,
|
| 436 |
-
denorm_absent = 0,
|
| 437 |
-
denorm_present = 1
|
| 438 |
-
};
|
| 439 |
-
}
|
| 440 |
-
```
|
| 441 |
-
|
| 442 |
-
The presence or absence of subnormal numbers (variable number of
|
| 443 |
-
exponent bits) is characterized by the values:
|
| 444 |
-
|
| 445 |
-
- `denorm_indeterminate` if it cannot be determined whether or not the
|
| 446 |
-
type allows subnormal values
|
| 447 |
-
- `denorm_absent` if the type does not allow subnormal values
|
| 448 |
-
- `denorm_present` if the type does allow subnormal values
|
| 449 |
-
|
| 450 |
-
### Class template `numeric_limits` <a id="numeric.limits">[[numeric.limits]]</a>
|
| 451 |
-
|
| 452 |
-
The `numeric_limits` class template provides a C++program with
|
| 453 |
-
information about various properties of the implementation’s
|
| 454 |
-
representation of the arithmetic types.
|
| 455 |
-
|
| 456 |
-
``` cpp
|
| 457 |
-
namespace std {
|
| 458 |
-
template<class T> class numeric_limits {
|
| 459 |
-
public:
|
| 460 |
-
static constexpr bool is_specialized = false;
|
| 461 |
-
static constexpr T min() noexcept { return T(); }
|
| 462 |
-
static constexpr T max() noexcept { return T(); }
|
| 463 |
-
static constexpr T lowest() noexcept { return T(); }
|
| 464 |
-
|
| 465 |
-
static constexpr int digits = 0;
|
| 466 |
-
static constexpr int digits10 = 0;
|
| 467 |
-
static constexpr int max_digits10 = 0;
|
| 468 |
-
static constexpr bool is_signed = false;
|
| 469 |
-
static constexpr bool is_integer = false;
|
| 470 |
-
static constexpr bool is_exact = false;
|
| 471 |
-
static constexpr int radix = 0;
|
| 472 |
-
static constexpr T epsilon() noexcept { return T(); }
|
| 473 |
-
static constexpr T round_error() noexcept { return T(); }
|
| 474 |
-
|
| 475 |
-
static constexpr int min_exponent = 0;
|
| 476 |
-
static constexpr int min_exponent10 = 0;
|
| 477 |
-
static constexpr int max_exponent = 0;
|
| 478 |
-
static constexpr int max_exponent10 = 0;
|
| 479 |
-
|
| 480 |
-
static constexpr bool has_infinity = false;
|
| 481 |
-
static constexpr bool has_quiet_NaN = false;
|
| 482 |
-
static constexpr bool has_signaling_NaN = false;
|
| 483 |
-
static constexpr float_denorm_style has_denorm = denorm_absent;
|
| 484 |
-
static constexpr bool has_denorm_loss = false;
|
| 485 |
-
static constexpr T infinity() noexcept { return T(); }
|
| 486 |
-
static constexpr T quiet_NaN() noexcept { return T(); }
|
| 487 |
-
static constexpr T signaling_NaN() noexcept { return T(); }
|
| 488 |
-
static constexpr T denorm_min() noexcept { return T(); }
|
| 489 |
-
|
| 490 |
-
static constexpr bool is_iec559 = false;
|
| 491 |
-
static constexpr bool is_bounded = false;
|
| 492 |
-
static constexpr bool is_modulo = false;
|
| 493 |
-
|
| 494 |
-
static constexpr bool traps = false;
|
| 495 |
-
static constexpr bool tinyness_before = false;
|
| 496 |
-
static constexpr float_round_style round_style = round_toward_zero;
|
| 497 |
-
};
|
| 498 |
-
|
| 499 |
-
template<class T> class numeric_limits<const T>;
|
| 500 |
-
template<class T> class numeric_limits<volatile T>;
|
| 501 |
-
template<class T> class numeric_limits<const volatile T>;
|
| 502 |
-
}
|
| 503 |
-
```
|
| 504 |
-
|
| 505 |
-
For all members declared `static` `constexpr` in the `numeric_limits`
|
| 506 |
-
template, specializations shall define these values in such a way that
|
| 507 |
-
they are usable as constant expressions.
|
| 508 |
-
|
| 509 |
-
The default `numeric_limits<T>` template shall have all members, but
|
| 510 |
-
with 0 or `false` values.
|
| 511 |
-
|
| 512 |
-
Specializations shall be provided for each arithmetic type, both
|
| 513 |
-
floating-point and integer, including `bool`. The member
|
| 514 |
-
`is_specialized` shall be `true` for all such specializations of
|
| 515 |
-
`numeric_limits`.
|
| 516 |
-
|
| 517 |
-
The value of each member of a specialization of `numeric_limits` on a
|
| 518 |
-
cv-qualified type `cv T` shall be equal to the value of the
|
| 519 |
-
corresponding member of the specialization on the unqualified type `T`.
|
| 520 |
-
|
| 521 |
-
Non-arithmetic standard types, such as `complex<T>` ([[complex]]),
|
| 522 |
-
shall not have specializations.
|
| 523 |
-
|
| 524 |
-
#### `numeric_limits` members <a id="numeric.limits.members">[[numeric.limits.members]]</a>
|
| 525 |
-
|
| 526 |
-
Each member function defined in this subclause is signal-safe (
|
| 527 |
-
[[csignal.syn]]).
|
| 528 |
-
|
| 529 |
-
``` cpp
|
| 530 |
-
static constexpr T min() noexcept;
|
| 531 |
-
```
|
| 532 |
-
|
| 533 |
-
Minimum finite value.[^3]
|
| 534 |
-
|
| 535 |
-
For floating types with subnormal numbers, returns the minimum positive
|
| 536 |
-
normalized value.
|
| 537 |
-
|
| 538 |
-
Meaningful for all specializations in which `is_bounded != false`, or
|
| 539 |
-
`is_bounded == false && is_signed == false`.
|
| 540 |
-
|
| 541 |
-
``` cpp
|
| 542 |
-
static constexpr T max() noexcept;
|
| 543 |
-
```
|
| 544 |
-
|
| 545 |
-
Maximum finite value.[^4]
|
| 546 |
-
|
| 547 |
-
Meaningful for all specializations in which `is_bounded != false`.
|
| 548 |
-
|
| 549 |
-
``` cpp
|
| 550 |
-
static constexpr T lowest() noexcept;
|
| 551 |
-
```
|
| 552 |
-
|
| 553 |
-
A finite value `x` such that there is no other finite value `y` where
|
| 554 |
-
`y < x`.[^5]
|
| 555 |
-
|
| 556 |
-
Meaningful for all specializations in which `is_bounded != false`.
|
| 557 |
-
|
| 558 |
-
``` cpp
|
| 559 |
-
static constexpr int digits;
|
| 560 |
-
```
|
| 561 |
-
|
| 562 |
-
Number of `radix` digits that can be represented without change.
|
| 563 |
-
|
| 564 |
-
For integer types, the number of non-sign bits in the representation.
|
| 565 |
-
|
| 566 |
-
For floating-point types, the number of `radix` digits in the
|
| 567 |
-
mantissa.[^6]
|
| 568 |
-
|
| 569 |
-
``` cpp
|
| 570 |
-
static constexpr int digits10;
|
| 571 |
-
```
|
| 572 |
-
|
| 573 |
-
Number of base 10 digits that can be represented without change.[^7]
|
| 574 |
-
|
| 575 |
-
Meaningful for all specializations in which `is_bounded != false`.
|
| 576 |
-
|
| 577 |
-
``` cpp
|
| 578 |
-
static constexpr int max_digits10;
|
| 579 |
-
```
|
| 580 |
-
|
| 581 |
-
Number of base 10 digits required to ensure that values which differ are
|
| 582 |
-
always differentiated.
|
| 583 |
-
|
| 584 |
-
Meaningful for all floating-point types.
|
| 585 |
-
|
| 586 |
-
``` cpp
|
| 587 |
-
static constexpr bool is_signed;
|
| 588 |
-
```
|
| 589 |
-
|
| 590 |
-
`true` if the type is signed.
|
| 591 |
-
|
| 592 |
-
Meaningful for all specializations.
|
| 593 |
-
|
| 594 |
-
``` cpp
|
| 595 |
-
static constexpr bool is_integer;
|
| 596 |
-
```
|
| 597 |
-
|
| 598 |
-
`true` if the type is integer.
|
| 599 |
-
|
| 600 |
-
Meaningful for all specializations.
|
| 601 |
-
|
| 602 |
-
``` cpp
|
| 603 |
-
static constexpr bool is_exact;
|
| 604 |
-
```
|
| 605 |
-
|
| 606 |
-
`true` if the type uses an exact representation. All integer types are
|
| 607 |
-
exact, but not all exact types are integer. For example, rational and
|
| 608 |
-
fixed-exponent representations are exact but not integer.
|
| 609 |
-
|
| 610 |
-
Meaningful for all specializations.
|
| 611 |
-
|
| 612 |
-
``` cpp
|
| 613 |
-
static constexpr int radix;
|
| 614 |
-
```
|
| 615 |
-
|
| 616 |
-
For floating types, specifies the base or radix of the exponent
|
| 617 |
-
representation (often 2).[^8]
|
| 618 |
-
|
| 619 |
-
For integer types, specifies the base of the representation.[^9]
|
| 620 |
-
|
| 621 |
-
Meaningful for all specializations.
|
| 622 |
-
|
| 623 |
-
``` cpp
|
| 624 |
-
static constexpr T epsilon() noexcept;
|
| 625 |
-
```
|
| 626 |
-
|
| 627 |
-
Machine epsilon: the difference between 1 and the least value greater
|
| 628 |
-
than 1 that is representable.[^10]
|
| 629 |
-
|
| 630 |
-
Meaningful for all floating-point types.
|
| 631 |
-
|
| 632 |
-
``` cpp
|
| 633 |
-
static constexpr T round_error() noexcept;
|
| 634 |
-
```
|
| 635 |
-
|
| 636 |
-
Measure of the maximum rounding error.[^11]
|
| 637 |
-
|
| 638 |
-
``` cpp
|
| 639 |
-
static constexpr int min_exponent;
|
| 640 |
-
```
|
| 641 |
-
|
| 642 |
-
Minimum negative integer such that `radix` raised to the power of one
|
| 643 |
-
less than that integer is a normalized floating-point number.[^12]
|
| 644 |
-
|
| 645 |
-
Meaningful for all floating-point types.
|
| 646 |
-
|
| 647 |
-
``` cpp
|
| 648 |
-
static constexpr int min_exponent10;
|
| 649 |
-
```
|
| 650 |
-
|
| 651 |
-
Minimum negative integer such that 10 raised to that power is in the
|
| 652 |
-
range of normalized floating-point numbers.[^13]
|
| 653 |
-
|
| 654 |
-
Meaningful for all floating-point types.
|
| 655 |
-
|
| 656 |
-
``` cpp
|
| 657 |
-
static constexpr int max_exponent;
|
| 658 |
-
```
|
| 659 |
-
|
| 660 |
-
Maximum positive integer such that `radix` raised to the power one less
|
| 661 |
-
than that integer is a representable finite floating-point number.[^14]
|
| 662 |
-
|
| 663 |
-
Meaningful for all floating-point types.
|
| 664 |
-
|
| 665 |
-
``` cpp
|
| 666 |
-
static constexpr int max_exponent10;
|
| 667 |
-
```
|
| 668 |
-
|
| 669 |
-
Maximum positive integer such that 10 raised to that power is in the
|
| 670 |
-
range of representable finite floating-point numbers.[^15]
|
| 671 |
-
|
| 672 |
-
Meaningful for all floating-point types.
|
| 673 |
-
|
| 674 |
-
``` cpp
|
| 675 |
-
static constexpr bool has_infinity;
|
| 676 |
-
```
|
| 677 |
-
|
| 678 |
-
`true` if the type has a representation for positive infinity.
|
| 679 |
-
|
| 680 |
-
Meaningful for all floating-point types.
|
| 681 |
-
|
| 682 |
-
Shall be `true` for all specializations in which `is_iec559 != false`.
|
| 683 |
-
|
| 684 |
-
``` cpp
|
| 685 |
-
static constexpr bool has_quiet_NaN;
|
| 686 |
-
```
|
| 687 |
-
|
| 688 |
-
`true` if the type has a representation for a quiet (non-signaling) “Not
|
| 689 |
-
a Number”.[^16]
|
| 690 |
-
|
| 691 |
-
Meaningful for all floating-point types.
|
| 692 |
-
|
| 693 |
-
Shall be `true` for all specializations in which `is_iec559 != false`.
|
| 694 |
-
|
| 695 |
-
``` cpp
|
| 696 |
-
static constexpr bool has_signaling_NaN;
|
| 697 |
-
```
|
| 698 |
-
|
| 699 |
-
`true` if the type has a representation for a signaling “Not a
|
| 700 |
-
Number”.[^17]
|
| 701 |
-
|
| 702 |
-
Meaningful for all floating-point types.
|
| 703 |
-
|
| 704 |
-
Shall be `true` for all specializations in which `is_iec559 != false`.
|
| 705 |
-
|
| 706 |
-
``` cpp
|
| 707 |
-
static constexpr float_denorm_style has_denorm;
|
| 708 |
-
```
|
| 709 |
-
|
| 710 |
-
`denorm_present` if the type allows subnormal values (variable number of
|
| 711 |
-
exponent bits)[^18], `denorm_absent` if the type does not allow
|
| 712 |
-
subnormal values, and `denorm_indeterminate` if it is indeterminate at
|
| 713 |
-
compile time whether the type allows subnormal values.
|
| 714 |
-
|
| 715 |
-
Meaningful for all floating-point types.
|
| 716 |
-
|
| 717 |
-
``` cpp
|
| 718 |
-
static constexpr bool has_denorm_loss;
|
| 719 |
-
```
|
| 720 |
-
|
| 721 |
-
`true` if loss of accuracy is detected as a denormalization loss, rather
|
| 722 |
-
than as an inexact result.[^19]
|
| 723 |
-
|
| 724 |
-
``` cpp
|
| 725 |
-
static constexpr T infinity() noexcept;
|
| 726 |
-
```
|
| 727 |
-
|
| 728 |
-
Representation of positive infinity, if available.[^20]
|
| 729 |
-
|
| 730 |
-
Meaningful for all specializations for which `has_infinity != false`.
|
| 731 |
-
Required in specializations for which `is_iec559 != false`.
|
| 732 |
-
|
| 733 |
-
``` cpp
|
| 734 |
-
static constexpr T quiet_NaN() noexcept;
|
| 735 |
-
```
|
| 736 |
-
|
| 737 |
-
Representation of a quiet “Not a Number”, if available.[^21]
|
| 738 |
-
|
| 739 |
-
Meaningful for all specializations for which `has_quiet_NaN != false`.
|
| 740 |
-
Required in specializations for which `is_iec559 != false`.
|
| 741 |
-
|
| 742 |
-
``` cpp
|
| 743 |
-
static constexpr T signaling_NaN() noexcept;
|
| 744 |
-
```
|
| 745 |
-
|
| 746 |
-
Representation of a signaling “Not a Number”, if available.[^22]
|
| 747 |
-
|
| 748 |
-
Meaningful for all specializations for which
|
| 749 |
-
`has_signaling_NaN != false`. Required in specializations for which
|
| 750 |
-
`is_iec559 != false`.
|
| 751 |
-
|
| 752 |
-
``` cpp
|
| 753 |
-
static constexpr T denorm_min() noexcept;
|
| 754 |
-
```
|
| 755 |
-
|
| 756 |
-
Minimum positive subnormal value.[^23]
|
| 757 |
-
|
| 758 |
-
Meaningful for all floating-point types.
|
| 759 |
-
|
| 760 |
-
In specializations for which `has_denorm == false`, returns the minimum
|
| 761 |
-
positive normalized value.
|
| 762 |
-
|
| 763 |
-
``` cpp
|
| 764 |
-
static constexpr bool is_iec559;
|
| 765 |
-
```
|
| 766 |
-
|
| 767 |
-
`true` if and only if the type adheres to ISO/IEC/IEEE 60559.[^24]
|
| 768 |
-
|
| 769 |
-
Meaningful for all floating-point types.
|
| 770 |
-
|
| 771 |
-
``` cpp
|
| 772 |
-
static constexpr bool is_bounded;
|
| 773 |
-
```
|
| 774 |
-
|
| 775 |
-
`true` if the set of values representable by the type is finite.[^25]
|
| 776 |
-
|
| 777 |
-
[*Note 1*: All fundamental types ([[basic.fundamental]]) are bounded.
|
| 778 |
-
This member would be `false` for arbitrary precision
|
| 779 |
-
types. — *end note*]
|
| 780 |
-
|
| 781 |
-
Meaningful for all specializations.
|
| 782 |
-
|
| 783 |
-
``` cpp
|
| 784 |
-
static constexpr bool is_modulo;
|
| 785 |
-
```
|
| 786 |
-
|
| 787 |
-
`true` if the type is modulo.[^26] A type is modulo if, for any
|
| 788 |
-
operation involving `+`, `-`, or `*` on values of that type whose result
|
| 789 |
-
would fall outside the range \[`min()`, `max()`\], the value returned
|
| 790 |
-
differs from the true value by an integer multiple of
|
| 791 |
-
`max() - min() + 1`.
|
| 792 |
-
|
| 793 |
-
[*Example 1*: `is_modulo` is `false` for signed integer
|
| 794 |
-
types ([[basic.fundamental]]) unless an implementation, as an extension
|
| 795 |
-
to this International Standard, defines signed integer overflow to
|
| 796 |
-
wrap. — *end example*]
|
| 797 |
-
|
| 798 |
-
Meaningful for all specializations.
|
| 799 |
-
|
| 800 |
-
``` cpp
|
| 801 |
-
static constexpr bool traps;
|
| 802 |
-
```
|
| 803 |
-
|
| 804 |
-
`true` if, at program startup, there exists a value of the type that
|
| 805 |
-
would cause an arithmetic operation using that value to trap.[^27]
|
| 806 |
-
|
| 807 |
-
Meaningful for all specializations.
|
| 808 |
-
|
| 809 |
-
``` cpp
|
| 810 |
-
static constexpr bool tinyness_before;
|
| 811 |
-
```
|
| 812 |
-
|
| 813 |
-
`true` if tinyness is detected before rounding.[^28]
|
| 814 |
-
|
| 815 |
-
Meaningful for all floating-point types.
|
| 816 |
-
|
| 817 |
-
``` cpp
|
| 818 |
-
static constexpr float_round_style round_style;
|
| 819 |
-
```
|
| 820 |
-
|
| 821 |
-
The rounding style for the type.[^29]
|
| 822 |
-
|
| 823 |
-
Meaningful for all floating-point types. Specializations for integer
|
| 824 |
-
types shall return `round_toward_zero`.
|
| 825 |
-
|
| 826 |
-
#### `numeric_limits` specializations <a id="numeric.special">[[numeric.special]]</a>
|
| 827 |
-
|
| 828 |
-
All members shall be provided for all specializations. However, many
|
| 829 |
-
values are only required to be meaningful under certain conditions (for
|
| 830 |
-
example, `epsilon()` is only meaningful if `is_integer` is `false`). Any
|
| 831 |
-
value that is not “meaningful” shall be set to 0 or `false`.
|
| 832 |
-
|
| 833 |
-
[*Example 1*:
|
| 834 |
-
|
| 835 |
-
``` cpp
|
| 836 |
-
namespace std {
|
| 837 |
-
template<> class numeric_limits<float> {
|
| 838 |
-
public:
|
| 839 |
-
static constexpr bool is_specialized = true;
|
| 840 |
-
|
| 841 |
-
static constexpr float min() noexcept { return 1.17549435E-38F; }
|
| 842 |
-
static constexpr float max() noexcept { return 3.40282347E+38F; }
|
| 843 |
-
static constexpr float lowest() noexcept { return -3.40282347E+38F; }
|
| 844 |
-
|
| 845 |
-
static constexpr int digits = 24;
|
| 846 |
-
static constexpr int digits10 = 6;
|
| 847 |
-
static constexpr int max_digits10 = 9;
|
| 848 |
-
|
| 849 |
-
static constexpr bool is_signed = true;
|
| 850 |
-
static constexpr bool is_integer = false;
|
| 851 |
-
static constexpr bool is_exact = false;
|
| 852 |
-
|
| 853 |
-
static constexpr int radix = 2;
|
| 854 |
-
static constexpr float epsilon() noexcept { return 1.19209290E-07F; }
|
| 855 |
-
static constexpr float round_error() noexcept { return 0.5F; }
|
| 856 |
-
|
| 857 |
-
static constexpr int min_exponent = -125;
|
| 858 |
-
static constexpr int min_exponent10 = - 37;
|
| 859 |
-
static constexpr int max_exponent = +128;
|
| 860 |
-
static constexpr int max_exponent10 = + 38;
|
| 861 |
-
|
| 862 |
-
static constexpr bool has_infinity = true;
|
| 863 |
-
static constexpr bool has_quiet_NaN = true;
|
| 864 |
-
static constexpr bool has_signaling_NaN = true;
|
| 865 |
-
static constexpr float_denorm_style has_denorm = denorm_absent;
|
| 866 |
-
static constexpr bool has_denorm_loss = false;
|
| 867 |
-
|
| 868 |
-
static constexpr float infinity() noexcept { return value; }
|
| 869 |
-
static constexpr float quiet_NaN() noexcept { return value; }
|
| 870 |
-
static constexpr float signaling_NaN() noexcept { return value; }
|
| 871 |
-
static constexpr float denorm_min() noexcept { return min(); }
|
| 872 |
-
|
| 873 |
-
static constexpr bool is_iec559 = true;
|
| 874 |
-
static constexpr bool is_bounded = true;
|
| 875 |
-
static constexpr bool is_modulo = false;
|
| 876 |
-
static constexpr bool traps = true;
|
| 877 |
-
static constexpr bool tinyness_before = true;
|
| 878 |
-
|
| 879 |
-
static constexpr float_round_style round_style = round_to_nearest;
|
| 880 |
-
};
|
| 881 |
-
}
|
| 882 |
-
```
|
| 883 |
-
|
| 884 |
-
— *end example*]
|
| 885 |
-
|
| 886 |
-
The specialization for `bool` shall be provided as follows:
|
| 887 |
-
|
| 888 |
-
``` cpp
|
| 889 |
-
namespace std {
|
| 890 |
-
template<> class numeric_limits<bool> {
|
| 891 |
-
public:
|
| 892 |
-
static constexpr bool is_specialized = true;
|
| 893 |
-
static constexpr bool min() noexcept { return false; }
|
| 894 |
-
static constexpr bool max() noexcept { return true; }
|
| 895 |
-
static constexpr bool lowest() noexcept { return false; }
|
| 896 |
-
|
| 897 |
-
static constexpr int digits = 1;
|
| 898 |
-
static constexpr int digits10 = 0;
|
| 899 |
-
static constexpr int max_digits10 = 0;
|
| 900 |
-
|
| 901 |
-
static constexpr bool is_signed = false;
|
| 902 |
-
static constexpr bool is_integer = true;
|
| 903 |
-
static constexpr bool is_exact = true;
|
| 904 |
-
static constexpr int radix = 2;
|
| 905 |
-
static constexpr bool epsilon() noexcept { return 0; }
|
| 906 |
-
static constexpr bool round_error() noexcept { return 0; }
|
| 907 |
-
|
| 908 |
-
static constexpr int min_exponent = 0;
|
| 909 |
-
static constexpr int min_exponent10 = 0;
|
| 910 |
-
static constexpr int max_exponent = 0;
|
| 911 |
-
static constexpr int max_exponent10 = 0;
|
| 912 |
-
|
| 913 |
-
static constexpr bool has_infinity = false;
|
| 914 |
-
static constexpr bool has_quiet_NaN = false;
|
| 915 |
-
static constexpr bool has_signaling_NaN = false;
|
| 916 |
-
static constexpr float_denorm_style has_denorm = denorm_absent;
|
| 917 |
-
static constexpr bool has_denorm_loss = false;
|
| 918 |
-
static constexpr bool infinity() noexcept { return 0; }
|
| 919 |
-
static constexpr bool quiet_NaN() noexcept { return 0; }
|
| 920 |
-
static constexpr bool signaling_NaN() noexcept { return 0; }
|
| 921 |
-
static constexpr bool denorm_min() noexcept { return 0; }
|
| 922 |
-
|
| 923 |
-
static constexpr bool is_iec559 = false;
|
| 924 |
-
static constexpr bool is_bounded = true;
|
| 925 |
-
static constexpr bool is_modulo = false;
|
| 926 |
-
|
| 927 |
-
static constexpr bool traps = false;
|
| 928 |
-
static constexpr bool tinyness_before = false;
|
| 929 |
-
static constexpr float_round_style round_style = round_toward_zero;
|
| 930 |
-
};
|
| 931 |
-
}
|
| 932 |
-
```
|
| 933 |
-
|
| 934 |
-
### Header `<climits>` synopsis <a id="climits.syn">[[climits.syn]]</a>
|
| 935 |
-
|
| 936 |
-
``` cpp
|
| 937 |
-
#define CHAR_BIT see below
|
| 938 |
-
#define SCHAR_MIN see below
|
| 939 |
-
#define SCHAR_MAX see below
|
| 940 |
-
#define UCHAR_MAX see below
|
| 941 |
-
#define CHAR_MIN see below
|
| 942 |
-
#define CHAR_MAX see below
|
| 943 |
-
#define MB_LEN_MAX see below
|
| 944 |
-
#define SHRT_MIN see below
|
| 945 |
-
#define SHRT_MAX see below
|
| 946 |
-
#define USHRT_MAX see below
|
| 947 |
-
#define INT_MIN see below
|
| 948 |
-
#define INT_MAX see below
|
| 949 |
-
#define UINT_MAX see below
|
| 950 |
-
#define LONG_MIN see below
|
| 951 |
-
#define LONG_MAX see below
|
| 952 |
-
#define ULONG_MAX see below
|
| 953 |
-
#define LLONG_MIN see below
|
| 954 |
-
#define LLONG_MAX see below
|
| 955 |
-
#define ULLONG_MAX see below
|
| 956 |
-
```
|
| 957 |
-
|
| 958 |
-
The header `<climits>` defines all macros the same as the C standard
|
| 959 |
-
library header `<limits.h>`.
|
| 960 |
-
|
| 961 |
-
[*Note 1*: The types of the constants defined by macros in `<climits>`
|
| 962 |
-
are not required to match the types to which the macros
|
| 963 |
-
refer. — *end note*]
|
| 964 |
-
|
| 965 |
-
ISO C 5.2.4.2.1
|
| 966 |
-
|
| 967 |
-
### Header `<cfloat>` synopsis <a id="cfloat.syn">[[cfloat.syn]]</a>
|
| 968 |
-
|
| 969 |
-
``` cpp
|
| 970 |
-
#define FLT_ROUNDS see below
|
| 971 |
-
#define FLT_EVAL_METHOD see below
|
| 972 |
-
#define FLT_HAS_SUBNORM see below
|
| 973 |
-
#define DBL_HAS_SUBNORM see below
|
| 974 |
-
#define LDBL_HAS_SUBNORM see below
|
| 975 |
-
#define FLT_RADIX see below
|
| 976 |
-
#define FLT_MANT_DIG see below
|
| 977 |
-
#define DBL_MANT_DIG see below
|
| 978 |
-
#define LDBL_MANT_DIG see below
|
| 979 |
-
#define FLT_DECIMAL_DIG see below
|
| 980 |
-
#define DBL_DECIMAL_DIG see below
|
| 981 |
-
#define LDBL_DECIMAL_DIG see below
|
| 982 |
-
#define DECIMAL_DIG see below
|
| 983 |
-
#define FLT_DIG see below
|
| 984 |
-
#define DBL_DIG see below
|
| 985 |
-
#define LDBL_DIG see below
|
| 986 |
-
#define FLT_MIN_EXP see below
|
| 987 |
-
#define DBL_MIN_EXP see below
|
| 988 |
-
#define LDBL_MIN_EXP see below
|
| 989 |
-
#define FLT_MIN_10_EXP see below
|
| 990 |
-
#define DBL_MIN_10_EXP see below
|
| 991 |
-
#define LDBL_MIN_10_EXP see below
|
| 992 |
-
#define FLT_MAX_EXP see below
|
| 993 |
-
#define DBL_MAX_EXP see below
|
| 994 |
-
#define LDBL_MAX_EXP see below
|
| 995 |
-
#define FLT_MAX_10_EXP see below
|
| 996 |
-
#define DBL_MAX_10_EXP see below
|
| 997 |
-
#define LDBL_MAX_10_EXP see below
|
| 998 |
-
#define FLT_MAX see below
|
| 999 |
-
#define DBL_MAX see below
|
| 1000 |
-
#define LDBL_MAX see below
|
| 1001 |
-
#define FLT_EPSILON see below
|
| 1002 |
-
#define DBL_EPSILON see below
|
| 1003 |
-
#define LDBL_EPSILON see below
|
| 1004 |
-
#define FLT_MIN see below
|
| 1005 |
-
#define DBL_MIN see below
|
| 1006 |
-
#define LDBL_MIN see below
|
| 1007 |
-
#define FLT_TRUE_MIN see below
|
| 1008 |
-
#define DBL_TRUE_MIN see below
|
| 1009 |
-
#define LDBL_TRUE_MIN see below
|
| 1010 |
-
```
|
| 1011 |
-
|
| 1012 |
-
The header `<cfloat>` defines all macros the same as the C standard
|
| 1013 |
-
library header `<float.h>`.
|
| 1014 |
-
|
| 1015 |
-
ISO C 5.2.4.2.2
|
| 1016 |
-
|
| 1017 |
-
## Integer types <a id="cstdint">[[cstdint]]</a>
|
| 1018 |
-
|
| 1019 |
-
### Header `<cstdint>` synopsis <a id="cstdint.syn">[[cstdint.syn]]</a>
|
| 1020 |
-
|
| 1021 |
-
``` cpp
|
| 1022 |
-
namespace std {
|
| 1023 |
-
using int8_t = signed integer type; // optional
|
| 1024 |
-
using int16_t = signed integer type; // optional
|
| 1025 |
-
using int32_t = signed integer type; // optional
|
| 1026 |
-
using int64_t = signed integer type; // optional
|
| 1027 |
-
|
| 1028 |
-
using int_fast8_t = signed integer type;
|
| 1029 |
-
using int_fast16_t = signed integer type;
|
| 1030 |
-
using int_fast32_t = signed integer type;
|
| 1031 |
-
using int_fast64_t = signed integer type;
|
| 1032 |
-
|
| 1033 |
-
using int_least8_t = signed integer type;
|
| 1034 |
-
using int_least16_t = signed integer type;
|
| 1035 |
-
using int_least32_t = signed integer type;
|
| 1036 |
-
using int_least64_t = signed integer type;
|
| 1037 |
-
|
| 1038 |
-
using intmax_t = signed integer type;
|
| 1039 |
-
using intptr_t = signed integer type; // optional
|
| 1040 |
-
|
| 1041 |
-
using uint8_t = unsigned integer type; // optional
|
| 1042 |
-
using uint16_t = unsigned integer type; // optional
|
| 1043 |
-
using uint32_t = unsigned integer type; // optional
|
| 1044 |
-
using uint64_t = unsigned integer type; // optional
|
| 1045 |
-
|
| 1046 |
-
using uint_fast8_t = unsigned integer type;
|
| 1047 |
-
using uint_fast16_t = unsigned integer type;
|
| 1048 |
-
using uint_fast32_t = unsigned integer type;
|
| 1049 |
-
using uint_fast64_t = unsigned integer type;
|
| 1050 |
-
|
| 1051 |
-
using uint_least8_t = unsigned integer type;
|
| 1052 |
-
using uint_least16_t = unsigned integer type;
|
| 1053 |
-
using uint_least32_t = unsigned integer type;
|
| 1054 |
-
using uint_least64_t = unsigned integer type;
|
| 1055 |
-
|
| 1056 |
-
using uintmax_t = unsigned integer type;
|
| 1057 |
-
using uintptr_t = unsigned integer type; // optional
|
| 1058 |
-
}
|
| 1059 |
-
```
|
| 1060 |
-
|
| 1061 |
-
The header also defines numerous macros of the form:
|
| 1062 |
-
|
| 1063 |
-
``` cpp
|
| 1064 |
-
INT_[FAST LEAST]{8 16 32 64}_MIN
|
| 1065 |
-
[U]INT_[FAST LEAST]{8 16 32 64}_MAX
|
| 1066 |
-
INT{MAX PTR}_MIN
|
| 1067 |
-
[U]INT{MAX PTR}_MAX
|
| 1068 |
-
{PTRDIFF SIG_ATOMIC WCHAR WINT}{_MAX _MIN}
|
| 1069 |
-
SIZE_MAX
|
| 1070 |
-
```
|
| 1071 |
-
|
| 1072 |
-
plus function macros of the form:
|
| 1073 |
-
|
| 1074 |
-
``` cpp
|
| 1075 |
-
[U]INT{8 16 32 64 MAX}_C
|
| 1076 |
-
```
|
| 1077 |
-
|
| 1078 |
-
The header defines all types and macros the same as the C standard
|
| 1079 |
-
library header `<stdint.h>`.
|
| 1080 |
-
|
| 1081 |
-
ISO C 7.20.
|
| 1082 |
-
|
| 1083 |
-
## Start and termination <a id="support.start.term">[[support.start.term]]</a>
|
| 1084 |
-
|
| 1085 |
-
[*Note 1*: The header `<cstdlib>` ([[cstdlib.syn]]) declares the
|
| 1086 |
-
functions described in this subclause. — *end note*]
|
| 1087 |
-
|
| 1088 |
-
``` cpp
|
| 1089 |
-
[[noreturn]] void _Exit(int status) noexcept;
|
| 1090 |
-
```
|
| 1091 |
-
|
| 1092 |
-
*Effects:* This function has the semantics specified in the C standard
|
| 1093 |
-
library.
|
| 1094 |
-
|
| 1095 |
-
*Remarks:* The program is terminated without executing destructors for
|
| 1096 |
-
objects of automatic, thread, or static storage duration and without
|
| 1097 |
-
calling functions passed to `atexit()` ([[basic.start.term]]). The
|
| 1098 |
-
function `_Exit` is signal-safe ([[csignal.syn]]).
|
| 1099 |
-
|
| 1100 |
-
``` cpp
|
| 1101 |
-
[[noreturn]] void abort() noexcept;
|
| 1102 |
-
```
|
| 1103 |
-
|
| 1104 |
-
*Effects:* This function has the semantics specified in the C standard
|
| 1105 |
-
library.
|
| 1106 |
-
|
| 1107 |
-
*Remarks:* The program is terminated without executing destructors for
|
| 1108 |
-
objects of automatic, thread, or static storage duration and without
|
| 1109 |
-
calling functions passed to `atexit()` ([[basic.start.term]]). The
|
| 1110 |
-
function `abort` is signal-safe ([[csignal.syn]]).
|
| 1111 |
-
|
| 1112 |
-
``` cpp
|
| 1113 |
-
int atexit(c-atexit-handler* f) noexcept;
|
| 1114 |
-
int atexit(atexit-handler* f) noexcept;
|
| 1115 |
-
```
|
| 1116 |
-
|
| 1117 |
-
*Effects:* The `atexit()` functions register the function pointed to by
|
| 1118 |
-
`f` to be called without arguments at normal program termination. It is
|
| 1119 |
-
unspecified whether a call to `atexit()` that does not happen
|
| 1120 |
-
before ([[intro.multithread]]) a call to `exit()` will succeed.
|
| 1121 |
-
|
| 1122 |
-
[*Note 1*: The `atexit()` functions do not introduce a data
|
| 1123 |
-
race ([[res.on.data.races]]). — *end note*]
|
| 1124 |
-
|
| 1125 |
-
*Implementation limits:* The implementation shall support the
|
| 1126 |
-
registration of at least 32 functions.
|
| 1127 |
-
|
| 1128 |
-
*Returns:* The `atexit()` function returns zero if the registration
|
| 1129 |
-
succeeds, nonzero if it fails.
|
| 1130 |
-
|
| 1131 |
-
``` cpp
|
| 1132 |
-
[[noreturn]] void exit(int status);
|
| 1133 |
-
```
|
| 1134 |
-
|
| 1135 |
-
*Effects:*
|
| 1136 |
-
|
| 1137 |
-
- First, objects with thread storage duration and associated with the
|
| 1138 |
-
current thread are destroyed. Next, objects with static storage
|
| 1139 |
-
duration are destroyed and functions registered by calling `atexit`
|
| 1140 |
-
are called.[^30] See [[basic.start.term]] for the order of
|
| 1141 |
-
destructions and calls. (Automatic objects are not destroyed as a
|
| 1142 |
-
result of calling `exit()`.)[^31] If control leaves a registered
|
| 1143 |
-
function called by `exit` because the function does not provide a
|
| 1144 |
-
handler for a thrown exception, `std::terminate()` shall be
|
| 1145 |
-
called ([[except.terminate]]).
|
| 1146 |
-
- Next, all open C streams (as mediated by the function signatures
|
| 1147 |
-
declared in `<cstdio>`) with unwritten buffered data are flushed, all
|
| 1148 |
-
open C streams are closed, and all files created by calling
|
| 1149 |
-
`tmpfile()` are removed.
|
| 1150 |
-
- Finally, control is returned to the host environment. If `status` is
|
| 1151 |
-
zero or `EXIT_SUCCESS`, an *implementation-defined* form of the status
|
| 1152 |
-
*successful termination* is returned. If `status` is `EXIT_FAILURE`,
|
| 1153 |
-
an *implementation-defined* form of the status *unsuccessful
|
| 1154 |
-
termination* is returned. Otherwise the status returned is
|
| 1155 |
-
*implementation-defined*.[^32]
|
| 1156 |
-
|
| 1157 |
-
``` cpp
|
| 1158 |
-
int at_quick_exit(c-atexit-handler* f) noexcept;
|
| 1159 |
-
int at_quick_exit(atexit-handler* f) noexcept;
|
| 1160 |
-
```
|
| 1161 |
-
|
| 1162 |
-
*Effects:* The `at_quick_exit()` functions register the function pointed
|
| 1163 |
-
to by `f` to be called without arguments when `quick_exit` is called. It
|
| 1164 |
-
is unspecified whether a call to `at_quick_exit()` that does not happen
|
| 1165 |
-
before ([[intro.multithread]]) all calls to `quick_exit` will succeed.
|
| 1166 |
-
|
| 1167 |
-
[*Note 2*: The `at_quick_exit()` functions do not introduce a data
|
| 1168 |
-
race ([[res.on.data.races]]). — *end note*]
|
| 1169 |
-
|
| 1170 |
-
[*Note 3*: The order of registration may be indeterminate if
|
| 1171 |
-
`at_quick_exit` was called from more than one thread. — *end note*]
|
| 1172 |
-
|
| 1173 |
-
[*Note 4*: The `at_quick_exit` registrations are distinct from the
|
| 1174 |
-
`atexit` registrations, and applications may need to call both
|
| 1175 |
-
registration functions with the same argument. — *end note*]
|
| 1176 |
-
|
| 1177 |
-
*Implementation limits:* The implementation shall support the
|
| 1178 |
-
registration of at least 32 functions.
|
| 1179 |
-
|
| 1180 |
-
*Returns:* Zero if the registration succeeds, nonzero if it fails.
|
| 1181 |
-
|
| 1182 |
-
``` cpp
|
| 1183 |
-
[[noreturn]] void quick_exit(int status) noexcept;
|
| 1184 |
-
```
|
| 1185 |
-
|
| 1186 |
-
*Effects:* Functions registered by calls to `at_quick_exit` are called
|
| 1187 |
-
in the reverse order of their registration, except that a function shall
|
| 1188 |
-
be called after any previously registered functions that had already
|
| 1189 |
-
been called at the time it was registered. Objects shall not be
|
| 1190 |
-
destroyed as a result of calling `quick_exit`. If control leaves a
|
| 1191 |
-
registered function called by `quick_exit` because the function does not
|
| 1192 |
-
provide a handler for a thrown exception, `std::terminate()` shall be
|
| 1193 |
-
called.
|
| 1194 |
-
|
| 1195 |
-
[*Note 5*: A function registered via `at_quick_exit` is invoked by the
|
| 1196 |
-
thread that calls `quick_exit`, which can be a different thread than the
|
| 1197 |
-
one that registered it, so registered functions should not rely on the
|
| 1198 |
-
identity of objects with thread storage duration. — *end note*]
|
| 1199 |
-
|
| 1200 |
-
After calling registered functions, `quick_exit` shall call
|
| 1201 |
-
`_Exit(status)`.
|
| 1202 |
-
|
| 1203 |
-
[*Note 6*: The standard file buffers are not flushed. — *end note*]
|
| 1204 |
-
|
| 1205 |
-
*Remarks:* The function `quick_exit` is signal-safe ([[csignal.syn]])
|
| 1206 |
-
when the functions registered with `at_quick_exit` are.
|
| 1207 |
-
|
| 1208 |
-
[[basic.start]], [[basic.start.term]], ISO C 7.22.4.
|
| 1209 |
-
|
| 1210 |
-
## Dynamic memory management <a id="support.dynamic">[[support.dynamic]]</a>
|
| 1211 |
-
|
| 1212 |
-
The header `<new>` defines several functions that manage the allocation
|
| 1213 |
-
of dynamic storage in a program. It also defines components for
|
| 1214 |
-
reporting storage management errors.
|
| 1215 |
-
|
| 1216 |
-
### Header `<new>` synopsis <a id="new.syn">[[new.syn]]</a>
|
| 1217 |
-
|
| 1218 |
-
``` cpp
|
| 1219 |
-
namespace std {
|
| 1220 |
-
class bad_alloc;
|
| 1221 |
-
class bad_array_new_length;
|
| 1222 |
-
enum class align_val_t : size_t {};
|
| 1223 |
-
struct nothrow_t { explicit nothrow_t() = default; };
|
| 1224 |
-
extern const nothrow_t nothrow;
|
| 1225 |
-
using new_handler = void (*)();
|
| 1226 |
-
new_handler get_new_handler() noexcept;
|
| 1227 |
-
new_handler set_new_handler(new_handler new_p) noexcept;
|
| 1228 |
-
|
| 1229 |
-
// [ptr.launder], pointer optimization barrier
|
| 1230 |
-
template <class T> constexpr T* launder(T* p) noexcept;
|
| 1231 |
-
|
| 1232 |
-
// [hardware.interference], hardware interference size
|
| 1233 |
-
inline constexpr size_t hardware_destructive_interference_size = implementation-defined{};
|
| 1234 |
-
inline constexpr size_t hardware_constructive_interference_size = implementation-defined{};
|
| 1235 |
-
}
|
| 1236 |
-
|
| 1237 |
-
void* operator new(std::size_t size);
|
| 1238 |
-
void* operator new(std::size_t size, std::align_val_t alignment);
|
| 1239 |
-
void* operator new(std::size_t size, const std::nothrow_t&) noexcept;
|
| 1240 |
-
void* operator new(std::size_t size, std::align_val_t alignment,
|
| 1241 |
-
const std::nothrow_t&) noexcept;
|
| 1242 |
-
void operator delete(void* ptr) noexcept;
|
| 1243 |
-
void operator delete(void* ptr, std::size_t size) noexcept;
|
| 1244 |
-
void operator delete(void* ptr, std::align_val_t alignment) noexcept;
|
| 1245 |
-
void operator delete(void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
|
| 1246 |
-
void operator delete(void* ptr, const std::nothrow_t&) noexcept;
|
| 1247 |
-
void operator delete(void* ptr, std::align_val_t alignment,
|
| 1248 |
-
const std::nothrow_t&) noexcept;
|
| 1249 |
-
void* operator new[](std::size_t size);
|
| 1250 |
-
void* operator new[](std::size_t size, std::align_val_t alignment);
|
| 1251 |
-
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept;
|
| 1252 |
-
void* operator new[](std::size_t size, std::align_val_t alignment,
|
| 1253 |
-
const std::nothrow_t&) noexcept;
|
| 1254 |
-
void operator delete[](void* ptr) noexcept;
|
| 1255 |
-
void operator delete[](void* ptr, std::size_t size) noexcept;
|
| 1256 |
-
void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
|
| 1257 |
-
void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
|
| 1258 |
-
void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
|
| 1259 |
-
void operator delete[](void* ptr, std::align_val_t alignment,
|
| 1260 |
-
const std::nothrow_t&) noexcept;
|
| 1261 |
-
|
| 1262 |
-
void* operator new (std::size_t size, void* ptr) noexcept;
|
| 1263 |
-
void* operator new[](std::size_t size, void* ptr) noexcept;
|
| 1264 |
-
void operator delete (void* ptr, void*) noexcept;
|
| 1265 |
-
void operator delete[](void* ptr, void*) noexcept;
|
| 1266 |
-
```
|
| 1267 |
-
|
| 1268 |
-
[[intro.memory]], [[basic.stc.dynamic]], [[expr.new]],
|
| 1269 |
-
[[expr.delete]], [[class.free]], [[memory]].
|
| 1270 |
-
|
| 1271 |
-
### Storage allocation and deallocation <a id="new.delete">[[new.delete]]</a>
|
| 1272 |
-
|
| 1273 |
-
Except where otherwise specified, the provisions of
|
| 1274 |
-
[[basic.stc.dynamic]] apply to the library versions of `operator new`
|
| 1275 |
-
and `operator
|
| 1276 |
-
delete`. If the value of an alignment argument passed to any of these
|
| 1277 |
-
functions is not a valid alignment value, the behavior is undefined.
|
| 1278 |
-
|
| 1279 |
-
#### Single-object forms <a id="new.delete.single">[[new.delete.single]]</a>
|
| 1280 |
-
|
| 1281 |
-
``` cpp
|
| 1282 |
-
void* operator new(std::size_t size);
|
| 1283 |
-
void* operator new(std::size_t size, std::align_val_t alignment);
|
| 1284 |
-
```
|
| 1285 |
-
|
| 1286 |
-
*Effects:* The allocation functions ([[basic.stc.dynamic.allocation]])
|
| 1287 |
-
called by a *new-expression* ([[expr.new]]) to allocate `size` bytes of
|
| 1288 |
-
storage. The second form is called for a type with new-extended
|
| 1289 |
-
alignment, and allocates storage with the specified alignment. The first
|
| 1290 |
-
form is called otherwise, and allocates storage suitably aligned to
|
| 1291 |
-
represent any object of that size provided the object’s type does not
|
| 1292 |
-
have new-extended alignment.
|
| 1293 |
-
|
| 1294 |
-
*Replaceable:* A C++program may define functions with either of these
|
| 1295 |
-
function signatures, and thereby displace the default versions defined
|
| 1296 |
-
by the C++standard library.
|
| 1297 |
-
|
| 1298 |
-
*Required behavior:* Return a non-null pointer to suitably aligned
|
| 1299 |
-
storage ([[basic.stc.dynamic]]), or else throw a `bad_alloc` exception.
|
| 1300 |
-
This requirement is binding on any replacement versions of these
|
| 1301 |
-
functions.
|
| 1302 |
-
|
| 1303 |
-
*Default behavior:*
|
| 1304 |
-
|
| 1305 |
-
- Executes a loop: Within the loop, the function first attempts to
|
| 1306 |
-
allocate the requested storage. Whether the attempt involves a call to
|
| 1307 |
-
the C standard library functions `malloc` or `aligned_alloc` is
|
| 1308 |
-
unspecified.
|
| 1309 |
-
- Returns a pointer to the allocated storage if the attempt is
|
| 1310 |
-
successful. Otherwise, if the current
|
| 1311 |
-
`new_handler` ([[get.new.handler]]) is a null pointer value, throws
|
| 1312 |
-
`bad_alloc`.
|
| 1313 |
-
- Otherwise, the function calls the current `new_handler`
|
| 1314 |
-
function ([[new.handler]]). If the called function returns, the loop
|
| 1315 |
-
repeats.
|
| 1316 |
-
- The loop terminates when an attempt to allocate the requested storage
|
| 1317 |
-
is successful or when a called `new_handler` function does not return.
|
| 1318 |
-
|
| 1319 |
-
``` cpp
|
| 1320 |
-
void* operator new(std::size_t size, const std::nothrow_t&) noexcept;
|
| 1321 |
-
void* operator new(std::size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept;
|
| 1322 |
-
```
|
| 1323 |
-
|
| 1324 |
-
*Effects:* Same as above, except that these are called by a placement
|
| 1325 |
-
version of a *new-expression* when a C++program prefers a null pointer
|
| 1326 |
-
result as an error indication, instead of a `bad_alloc` exception.
|
| 1327 |
-
|
| 1328 |
-
*Replaceable:* A C++program may define functions with either of these
|
| 1329 |
-
function signatures, and thereby displace the default versions defined
|
| 1330 |
-
by the C++standard library.
|
| 1331 |
-
|
| 1332 |
-
*Required behavior:* Return a non-null pointer to suitably aligned
|
| 1333 |
-
storage ([[basic.stc.dynamic]]), or else return a null pointer. Each of
|
| 1334 |
-
these nothrow versions of `operator new` returns a pointer obtained as
|
| 1335 |
-
if acquired from the (possibly replaced) corresponding non-placement
|
| 1336 |
-
function. This requirement is binding on any replacement versions of
|
| 1337 |
-
these functions.
|
| 1338 |
-
|
| 1339 |
-
*Default behavior:* Calls `operator new(size)`, or
|
| 1340 |
-
`operator new(size, alignment)`, respectively. If the call returns
|
| 1341 |
-
normally, returns the result of that call. Otherwise, returns a null
|
| 1342 |
-
pointer.
|
| 1343 |
-
|
| 1344 |
-
[*Example 1*:
|
| 1345 |
-
|
| 1346 |
-
``` cpp
|
| 1347 |
-
T* p1 = new T; // throws bad_alloc if it fails
|
| 1348 |
-
T* p2 = new(nothrow) T; // returns nullptr if it fails
|
| 1349 |
-
```
|
| 1350 |
-
|
| 1351 |
-
— *end example*]
|
| 1352 |
-
|
| 1353 |
-
``` cpp
|
| 1354 |
-
void operator delete(void* ptr) noexcept;
|
| 1355 |
-
void operator delete(void* ptr, std::size_t size) noexcept;
|
| 1356 |
-
void operator delete(void* ptr, std::align_val_t alignment) noexcept;
|
| 1357 |
-
void operator delete(void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
|
| 1358 |
-
```
|
| 1359 |
-
|
| 1360 |
-
*Effects:* The deallocation
|
| 1361 |
-
functions ([[basic.stc.dynamic.deallocation]]) called by a
|
| 1362 |
-
*delete-expression* to render the value of `ptr` invalid.
|
| 1363 |
-
|
| 1364 |
-
*Replaceable:* A C++program may define functions with any of these
|
| 1365 |
-
function signatures, and thereby displace the default versions defined
|
| 1366 |
-
by the C++standard library.
|
| 1367 |
-
|
| 1368 |
-
If a function without a `size` parameter is defined, the program should
|
| 1369 |
-
also define the corresponding function with a `size` parameter. If a
|
| 1370 |
-
function with a `size` parameter is defined, the program shall also
|
| 1371 |
-
define the corresponding version without the `size` parameter.
|
| 1372 |
-
|
| 1373 |
-
[*Note 1*: The default behavior below may change in the future, which
|
| 1374 |
-
will require replacing both deallocation functions when replacing the
|
| 1375 |
-
allocation function. — *end note*]
|
| 1376 |
-
|
| 1377 |
-
*Requires:* `ptr` shall be a null pointer or its value shall represent
|
| 1378 |
-
the address of a block of memory allocated by an earlier call to a
|
| 1379 |
-
(possibly replaced) `operator new(std::size_t)` or
|
| 1380 |
-
`operator new(std::size_t, std::align_val_t)` which has not been
|
| 1381 |
-
invalidated by an intervening call to `operator delete`.
|
| 1382 |
-
|
| 1383 |
-
*Requires:* If an implementation has strict pointer
|
| 1384 |
-
safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
|
| 1385 |
-
safely-derived pointer.
|
| 1386 |
-
|
| 1387 |
-
*Requires:* If the `alignment` parameter is not present, `ptr` shall
|
| 1388 |
-
have been returned by an allocation function without an `alignment`
|
| 1389 |
-
parameter. If present, the `alignment` argument shall equal the
|
| 1390 |
-
`alignment` argument passed to the allocation function that returned
|
| 1391 |
-
`ptr`. If present, the `size` argument shall equal the `size` argument
|
| 1392 |
-
passed to the allocation function that returned `ptr`.
|
| 1393 |
-
|
| 1394 |
-
*Required behavior:* A call to an `operator delete` with a `size`
|
| 1395 |
-
parameter may be changed to a call to the corresponding
|
| 1396 |
-
`operator delete` without a `size` parameter, without affecting memory
|
| 1397 |
-
allocation.
|
| 1398 |
-
|
| 1399 |
-
[*Note 2*: A conforming implementation is for
|
| 1400 |
-
`operator delete(void* ptr, std::size_t size)` to simply call
|
| 1401 |
-
`operator delete(ptr)`. — *end note*]
|
| 1402 |
-
|
| 1403 |
-
*Default behavior:* The functions that have a `size` parameter forward
|
| 1404 |
-
their other parameters to the corresponding function without a `size`
|
| 1405 |
-
parameter.
|
| 1406 |
-
|
| 1407 |
-
[*Note 3*: See the note in the above *Replaceable:*
|
| 1408 |
-
paragraph. — *end note*]
|
| 1409 |
-
|
| 1410 |
-
*Default behavior:* If `ptr` is null, does nothing. Otherwise, reclaims
|
| 1411 |
-
the storage allocated by the earlier call to `operator new`.
|
| 1412 |
-
|
| 1413 |
-
*Remarks:* It is unspecified under what conditions part or all of such
|
| 1414 |
-
reclaimed storage will be allocated by subsequent calls to
|
| 1415 |
-
`operator new` or any of `aligned_alloc`, `calloc`, `malloc`, or
|
| 1416 |
-
`realloc`, declared in `<cstdlib>`.
|
| 1417 |
-
|
| 1418 |
-
``` cpp
|
| 1419 |
-
void operator delete(void* ptr, const std::nothrow_t&) noexcept;
|
| 1420 |
-
void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
|
| 1421 |
-
```
|
| 1422 |
-
|
| 1423 |
-
*Effects:* The deallocation
|
| 1424 |
-
functions ([[basic.stc.dynamic.deallocation]]) called by the
|
| 1425 |
-
implementation to render the value of `ptr` invalid when the constructor
|
| 1426 |
-
invoked from a nothrow placement version of the *new-expression* throws
|
| 1427 |
-
an exception.
|
| 1428 |
-
|
| 1429 |
-
*Replaceable:* A C++program may define functions with either of these
|
| 1430 |
-
function signatures, and thereby displace the default versions defined
|
| 1431 |
-
by the C++standard library.
|
| 1432 |
-
|
| 1433 |
-
*Requires:* `ptr` shall be a null pointer or its value shall represent
|
| 1434 |
-
the address of a block of memory allocated by an earlier call to a
|
| 1435 |
-
(possibly replaced) `operator new(std::size_t)` or
|
| 1436 |
-
`operator new(std::size_t, std::align_val_t)` which has not been
|
| 1437 |
-
invalidated by an intervening call to `operator delete`.
|
| 1438 |
-
|
| 1439 |
-
*Requires:* If an implementation has strict pointer
|
| 1440 |
-
safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
|
| 1441 |
-
safely-derived pointer.
|
| 1442 |
-
|
| 1443 |
-
*Requires:* If the `alignment` parameter is not present, `ptr` shall
|
| 1444 |
-
have been returned by an allocation function without an `alignment`
|
| 1445 |
-
parameter. If present, the `alignment` argument shall equal the
|
| 1446 |
-
`alignment` argument passed to the allocation function that returned
|
| 1447 |
-
`ptr`.
|
| 1448 |
-
|
| 1449 |
-
*Default behavior:* Calls `operator delete(ptr)`, or
|
| 1450 |
-
`operator delete(ptr, alignment)`, respectively.
|
| 1451 |
-
|
| 1452 |
-
#### Array forms <a id="new.delete.array">[[new.delete.array]]</a>
|
| 1453 |
-
|
| 1454 |
-
``` cpp
|
| 1455 |
-
void* operator new[](std::size_t size);
|
| 1456 |
-
void* operator new[](std::size_t size, std::align_val_t alignment);
|
| 1457 |
-
```
|
| 1458 |
-
|
| 1459 |
-
*Effects:* The allocation functions ([[basic.stc.dynamic.allocation]])
|
| 1460 |
-
called by the array form of a *new-expression* ([[expr.new]]) to
|
| 1461 |
-
allocate `size` bytes of storage. The second form is called for a type
|
| 1462 |
-
with new-extended alignment, and allocates storage with the specified
|
| 1463 |
-
alignment. The first form is called otherwise, and allocates storage
|
| 1464 |
-
suitably aligned to represent any array object of that size or smaller,
|
| 1465 |
-
provided the object’s type does not have new-extended alignment. [^33]
|
| 1466 |
-
|
| 1467 |
-
*Replaceable:* A C++program may define functions with either of these
|
| 1468 |
-
function signatures, and thereby displace the default versions defined
|
| 1469 |
-
by the C++standard library.
|
| 1470 |
-
|
| 1471 |
-
*Required behavior:* Same as for the corresponding single-object forms.
|
| 1472 |
-
This requirement is binding on any replacement versions of these
|
| 1473 |
-
functions.
|
| 1474 |
-
|
| 1475 |
-
*Default behavior:* Returns `operator new(size)`, or
|
| 1476 |
-
`operator new(size, alignment)`, respectively.
|
| 1477 |
-
|
| 1478 |
-
``` cpp
|
| 1479 |
-
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept;
|
| 1480 |
-
void* operator new[](std::size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept;
|
| 1481 |
-
```
|
| 1482 |
-
|
| 1483 |
-
*Effects:* Same as above, except that these are called by a placement
|
| 1484 |
-
version of a *new-expression* when a C++program prefers a null pointer
|
| 1485 |
-
result as an error indication, instead of a `bad_alloc` exception.
|
| 1486 |
-
|
| 1487 |
-
*Replaceable:* A C++program may define functions with either of these
|
| 1488 |
-
function signatures, and thereby displace the default versions defined
|
| 1489 |
-
by the C++standard library.
|
| 1490 |
-
|
| 1491 |
-
*Required behavior:* Return a non-null pointer to suitably aligned
|
| 1492 |
-
storage ([[basic.stc.dynamic]]), or else return a null pointer. Each of
|
| 1493 |
-
these nothrow versions of `operator new[]` returns a pointer obtained as
|
| 1494 |
-
if acquired from the (possibly replaced) corresponding non-placement
|
| 1495 |
-
function. This requirement is binding on any replacement versions of
|
| 1496 |
-
these functions.
|
| 1497 |
-
|
| 1498 |
-
*Default behavior:* Calls `operator new[](size)`, or
|
| 1499 |
-
`operator new[](size, alignment)`, respectively. If the call returns
|
| 1500 |
-
normally, returns the result of that call. Otherwise, returns a null
|
| 1501 |
-
pointer.
|
| 1502 |
-
|
| 1503 |
-
``` cpp
|
| 1504 |
-
void operator delete[](void* ptr) noexcept;
|
| 1505 |
-
void operator delete[](void* ptr, std::size_t size) noexcept;
|
| 1506 |
-
void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
|
| 1507 |
-
void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
|
| 1508 |
-
```
|
| 1509 |
-
|
| 1510 |
-
*Effects:* The deallocation
|
| 1511 |
-
functions ([[basic.stc.dynamic.deallocation]]) called by the array form
|
| 1512 |
-
of a *delete-expression* to render the value of `ptr` invalid.
|
| 1513 |
-
|
| 1514 |
-
*Replaceable:* A C++program may define functions with any of these
|
| 1515 |
-
function signatures, and thereby displace the default versions defined
|
| 1516 |
-
by the C++standard library.
|
| 1517 |
-
|
| 1518 |
-
If a function without a `size` parameter is defined, the program should
|
| 1519 |
-
also define the corresponding function with a `size` parameter. If a
|
| 1520 |
-
function with a `size` parameter is defined, the program shall also
|
| 1521 |
-
define the corresponding version without the `size` parameter.
|
| 1522 |
-
|
| 1523 |
-
[*Note 1*: The default behavior below may change in the future, which
|
| 1524 |
-
will require replacing both deallocation functions when replacing the
|
| 1525 |
-
allocation function. — *end note*]
|
| 1526 |
-
|
| 1527 |
-
*Requires:* `ptr` shall be a null pointer or its value shall represent
|
| 1528 |
-
the address of a block of memory allocated by an earlier call to a
|
| 1529 |
-
(possibly replaced) `operator new[](std::size_t)` or
|
| 1530 |
-
`operator new[](std::size_t, std::align_val_t)` which has not been
|
| 1531 |
-
invalidated by an intervening call to `operator delete[]`.
|
| 1532 |
-
|
| 1533 |
-
*Requires:* If an implementation has strict pointer
|
| 1534 |
-
safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
|
| 1535 |
-
safely-derived pointer.
|
| 1536 |
-
|
| 1537 |
-
*Requires:* If the `alignment` parameter is not present, `ptr` shall
|
| 1538 |
-
have been returned by an allocation function without an `alignment`
|
| 1539 |
-
parameter. If present, the `alignment` argument shall equal the
|
| 1540 |
-
`alignment` argument passed to the allocation function that returned
|
| 1541 |
-
`ptr`. If present, the `size` argument shall equal the `size` argument
|
| 1542 |
-
passed to the allocation function that returned `ptr`.
|
| 1543 |
-
|
| 1544 |
-
*Required behavior:* A call to an `operator delete[]` with a `size`
|
| 1545 |
-
parameter may be changed to a call to the corresponding
|
| 1546 |
-
`operator delete[]` without a `size` parameter, without affecting memory
|
| 1547 |
-
allocation.
|
| 1548 |
-
|
| 1549 |
-
[*Note 2*: A conforming implementation is for
|
| 1550 |
-
`operator delete[](void* ptr, std::size_t size)` to simply call
|
| 1551 |
-
`operator delete[](ptr)`. — *end note*]
|
| 1552 |
-
|
| 1553 |
-
*Default behavior:* The functions that have a `size` parameter forward
|
| 1554 |
-
their other parameters to the corresponding function without a `size`
|
| 1555 |
-
parameter. The functions that do not have a `size` parameter forward
|
| 1556 |
-
their parameters to the corresponding `operator delete` (single-object)
|
| 1557 |
-
function.
|
| 1558 |
-
|
| 1559 |
-
``` cpp
|
| 1560 |
-
void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
|
| 1561 |
-
void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
|
| 1562 |
-
```
|
| 1563 |
-
|
| 1564 |
-
*Effects:* The deallocation
|
| 1565 |
-
functions ([[basic.stc.dynamic.deallocation]]) called by the
|
| 1566 |
-
implementation to render the value of `ptr` invalid when the constructor
|
| 1567 |
-
invoked from a nothrow placement version of the array *new-expression*
|
| 1568 |
-
throws an exception.
|
| 1569 |
-
|
| 1570 |
-
*Replaceable:* A C++program may define functions with either of these
|
| 1571 |
-
function signatures, and thereby displace the default versions defined
|
| 1572 |
-
by the C++standard library.
|
| 1573 |
-
|
| 1574 |
-
*Requires:* `ptr` shall be a null pointer or its value shall represent
|
| 1575 |
-
the address of a block of memory allocated by an earlier call to a
|
| 1576 |
-
(possibly replaced) `operator new[](std::size_t)` or
|
| 1577 |
-
`operator new[](std::size_t, std::align_val_t)` which has not been
|
| 1578 |
-
invalidated by an intervening call to `operator delete[]`.
|
| 1579 |
-
|
| 1580 |
-
*Requires:* If an implementation has strict pointer
|
| 1581 |
-
safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
|
| 1582 |
-
safely-derived pointer.
|
| 1583 |
-
|
| 1584 |
-
*Requires:* If the `alignment` parameter is not present, `ptr` shall
|
| 1585 |
-
have been returned by an allocation function without an `alignment`
|
| 1586 |
-
parameter. If present, the `alignment` argument shall equal the
|
| 1587 |
-
`alignment` argument passed to the allocation function that returned
|
| 1588 |
-
`ptr`.
|
| 1589 |
-
|
| 1590 |
-
*Default behavior:* Calls `operator delete[](ptr)`, or
|
| 1591 |
-
`operator delete[](ptr, alignment)`, respectively.
|
| 1592 |
-
|
| 1593 |
-
#### Non-allocating forms <a id="new.delete.placement">[[new.delete.placement]]</a>
|
| 1594 |
-
|
| 1595 |
-
These functions are reserved; a C++program may not define functions that
|
| 1596 |
-
displace the versions in the C++standard library ([[constraints]]). The
|
| 1597 |
-
provisions of [[basic.stc.dynamic]] do not apply to these reserved
|
| 1598 |
-
placement forms of `operator new` and `operator delete`.
|
| 1599 |
-
|
| 1600 |
-
``` cpp
|
| 1601 |
-
void* operator new(std::size_t size, void* ptr) noexcept;
|
| 1602 |
-
```
|
| 1603 |
-
|
| 1604 |
-
*Returns:* `ptr`.
|
| 1605 |
-
|
| 1606 |
-
*Remarks:* Intentionally performs no other action.
|
| 1607 |
-
|
| 1608 |
-
[*Example 1*:
|
| 1609 |
-
|
| 1610 |
-
This can be useful for constructing an object at a known address:
|
| 1611 |
-
|
| 1612 |
-
``` cpp
|
| 1613 |
-
void* place = operator new(sizeof(Something));
|
| 1614 |
-
Something* p = new (place) Something();
|
| 1615 |
-
```
|
| 1616 |
-
|
| 1617 |
-
— *end example*]
|
| 1618 |
-
|
| 1619 |
-
``` cpp
|
| 1620 |
-
void* operator new[](std::size_t size, void* ptr) noexcept;
|
| 1621 |
-
```
|
| 1622 |
-
|
| 1623 |
-
*Returns:* `ptr`.
|
| 1624 |
-
|
| 1625 |
-
*Remarks:* Intentionally performs no other action.
|
| 1626 |
-
|
| 1627 |
-
``` cpp
|
| 1628 |
-
void operator delete(void* ptr, void*) noexcept;
|
| 1629 |
-
```
|
| 1630 |
-
|
| 1631 |
-
*Effects:* Intentionally performs no action.
|
| 1632 |
-
|
| 1633 |
-
*Requires:* If an implementation has strict pointer
|
| 1634 |
-
safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
|
| 1635 |
-
safely-derived pointer.
|
| 1636 |
-
|
| 1637 |
-
*Remarks:* Default function called when any part of the initialization
|
| 1638 |
-
in a placement *new-expression* that invokes the library’s non-array
|
| 1639 |
-
placement operator new terminates by throwing an
|
| 1640 |
-
exception ([[expr.new]]).
|
| 1641 |
-
|
| 1642 |
-
``` cpp
|
| 1643 |
-
void operator delete[](void* ptr, void*) noexcept;
|
| 1644 |
-
```
|
| 1645 |
-
|
| 1646 |
-
*Effects:* Intentionally performs no action.
|
| 1647 |
-
|
| 1648 |
-
*Requires:* If an implementation has strict pointer
|
| 1649 |
-
safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
|
| 1650 |
-
safely-derived pointer.
|
| 1651 |
-
|
| 1652 |
-
*Remarks:* Default function called when any part of the initialization
|
| 1653 |
-
in a placement *new-expression* that invokes the library’s array
|
| 1654 |
-
placement operator new terminates by throwing an
|
| 1655 |
-
exception ([[expr.new]]).
|
| 1656 |
-
|
| 1657 |
-
#### Data races <a id="new.delete.dataraces">[[new.delete.dataraces]]</a>
|
| 1658 |
-
|
| 1659 |
-
For purposes of determining the existence of data races, the library
|
| 1660 |
-
versions of `operator new`, user replacement versions of global
|
| 1661 |
-
`operator new`, the C standard library functions `aligned_alloc`,
|
| 1662 |
-
`calloc`, and `malloc`, the library versions of `operator delete`, user
|
| 1663 |
-
replacement versions of `operator delete`, the C standard library
|
| 1664 |
-
function `free`, and the C standard library function `realloc` shall not
|
| 1665 |
-
introduce a data race ([[res.on.data.races]]). Calls to these functions
|
| 1666 |
-
that allocate or deallocate a particular unit of storage shall occur in
|
| 1667 |
-
a single total order, and each such deallocation call shall happen
|
| 1668 |
-
before ([[intro.multithread]]) the next allocation (if any) in this
|
| 1669 |
-
order.
|
| 1670 |
-
|
| 1671 |
-
### Storage allocation errors <a id="alloc.errors">[[alloc.errors]]</a>
|
| 1672 |
-
|
| 1673 |
-
#### Class `bad_alloc` <a id="bad.alloc">[[bad.alloc]]</a>
|
| 1674 |
-
|
| 1675 |
-
``` cpp
|
| 1676 |
-
namespace std {
|
| 1677 |
-
class bad_alloc : public exception {
|
| 1678 |
-
public:
|
| 1679 |
-
bad_alloc() noexcept;
|
| 1680 |
-
bad_alloc(const bad_alloc&) noexcept;
|
| 1681 |
-
bad_alloc& operator=(const bad_alloc&) noexcept;
|
| 1682 |
-
const char* what() const noexcept override;
|
| 1683 |
-
};
|
| 1684 |
-
}
|
| 1685 |
-
```
|
| 1686 |
-
|
| 1687 |
-
The class `bad_alloc` defines the type of objects thrown as exceptions
|
| 1688 |
-
by the implementation to report a failure to allocate storage.
|
| 1689 |
-
|
| 1690 |
-
``` cpp
|
| 1691 |
-
bad_alloc() noexcept;
|
| 1692 |
-
```
|
| 1693 |
-
|
| 1694 |
-
*Effects:* Constructs an object of class `bad_alloc`.
|
| 1695 |
-
|
| 1696 |
-
``` cpp
|
| 1697 |
-
bad_alloc(const bad_alloc&) noexcept;
|
| 1698 |
-
bad_alloc& operator=(const bad_alloc&) noexcept;
|
| 1699 |
-
```
|
| 1700 |
-
|
| 1701 |
-
*Effects:* Copies an object of class `bad_alloc`.
|
| 1702 |
-
|
| 1703 |
-
``` cpp
|
| 1704 |
-
const char* what() const noexcept override;
|
| 1705 |
-
```
|
| 1706 |
-
|
| 1707 |
-
*Returns:* An *implementation-defined* NTBS.
|
| 1708 |
-
|
| 1709 |
-
*Remarks:* The message may be a null-terminated multibyte
|
| 1710 |
-
string ([[multibyte.strings]]), suitable for conversion and display as
|
| 1711 |
-
a `wstring` ([[string.classes]], [[locale.codecvt]]).
|
| 1712 |
-
|
| 1713 |
-
#### Class `bad_array_new_length` <a id="new.badlength">[[new.badlength]]</a>
|
| 1714 |
-
|
| 1715 |
-
``` cpp
|
| 1716 |
-
namespace std {
|
| 1717 |
-
class bad_array_new_length : public bad_alloc {
|
| 1718 |
-
public:
|
| 1719 |
-
bad_array_new_length() noexcept;
|
| 1720 |
-
const char* what() const noexcept override;
|
| 1721 |
-
};
|
| 1722 |
-
}
|
| 1723 |
-
```
|
| 1724 |
-
|
| 1725 |
-
The class `bad_array_new_length` defines the type of objects thrown as
|
| 1726 |
-
exceptions by the implementation to report an attempt to allocate an
|
| 1727 |
-
array of size less than zero or greater than an *implementation-defined*
|
| 1728 |
-
limit ([[expr.new]]).
|
| 1729 |
-
|
| 1730 |
-
``` cpp
|
| 1731 |
-
bad_array_new_length() noexcept;
|
| 1732 |
-
```
|
| 1733 |
-
|
| 1734 |
-
*Effects:* constructs an object of class `bad_array_new_length`.
|
| 1735 |
-
|
| 1736 |
-
``` cpp
|
| 1737 |
-
const char* what() const noexcept override;
|
| 1738 |
-
```
|
| 1739 |
-
|
| 1740 |
-
*Returns:* An *implementation-defined* NTBS.
|
| 1741 |
-
|
| 1742 |
-
*Remarks:* The message may be a null-terminated multibyte
|
| 1743 |
-
string ([[multibyte.strings]]), suitable for conversion and display as
|
| 1744 |
-
a `wstring` ([[string.classes]], [[locale.codecvt]]).
|
| 1745 |
-
|
| 1746 |
-
#### Type `new_handler` <a id="new.handler">[[new.handler]]</a>
|
| 1747 |
-
|
| 1748 |
-
``` cpp
|
| 1749 |
-
using new_handler = void (*)();
|
| 1750 |
-
```
|
| 1751 |
-
|
| 1752 |
-
The type of a *handler function* to be called by `operator new()` or
|
| 1753 |
-
`operator new[]()` ([[new.delete]]) when they cannot satisfy a request
|
| 1754 |
-
for additional storage.
|
| 1755 |
-
|
| 1756 |
-
*Required behavior:* A `new_handler` shall perform one of the following:
|
| 1757 |
-
|
| 1758 |
-
- make more storage available for allocation and then return;
|
| 1759 |
-
- throw an exception of type `bad_alloc` or a class derived from
|
| 1760 |
-
`bad_alloc`;
|
| 1761 |
-
- terminate execution of the program without returning to the caller.
|
| 1762 |
-
|
| 1763 |
-
#### `set_new_handler` <a id="set.new.handler">[[set.new.handler]]</a>
|
| 1764 |
-
|
| 1765 |
-
``` cpp
|
| 1766 |
-
new_handler set_new_handler(new_handler new_p) noexcept;
|
| 1767 |
-
```
|
| 1768 |
-
|
| 1769 |
-
*Effects:* Establishes the function designated by `new_p` as the current
|
| 1770 |
-
`new_handler`.
|
| 1771 |
-
|
| 1772 |
-
*Returns:* The previous `new_handler`.
|
| 1773 |
-
|
| 1774 |
-
*Remarks:* The initial `new_handler` is a null pointer.
|
| 1775 |
-
|
| 1776 |
-
#### `get_new_handler` <a id="get.new.handler">[[get.new.handler]]</a>
|
| 1777 |
-
|
| 1778 |
-
``` cpp
|
| 1779 |
-
new_handler get_new_handler() noexcept;
|
| 1780 |
-
```
|
| 1781 |
-
|
| 1782 |
-
*Returns:* The current `new_handler`.
|
| 1783 |
-
|
| 1784 |
-
[*Note 1*: This may be a null pointer value. — *end note*]
|
| 1785 |
-
|
| 1786 |
-
### Pointer optimization barrier <a id="ptr.launder">[[ptr.launder]]</a>
|
| 1787 |
-
|
| 1788 |
-
``` cpp
|
| 1789 |
-
template <class T> constexpr T* launder(T* p) noexcept;
|
| 1790 |
-
```
|
| 1791 |
-
|
| 1792 |
-
*Requires:* `p` represents the address *A* of a byte in memory. An
|
| 1793 |
-
object *X* that is within its lifetime ([[basic.life]]) and whose type
|
| 1794 |
-
is similar ([[conv.qual]]) to `T` is located at the address *A*. All
|
| 1795 |
-
bytes of storage that would be reachable through the result are
|
| 1796 |
-
reachable through `p` (see below).
|
| 1797 |
-
|
| 1798 |
-
*Returns:* A value of type `T *` that points to `X`.
|
| 1799 |
-
|
| 1800 |
-
*Remarks:* An invocation of this function may be used in a core constant
|
| 1801 |
-
expression whenever the value of its argument may be used in a core
|
| 1802 |
-
constant expression. A byte of storage is reachable through a pointer
|
| 1803 |
-
value that points to an object *Y* if it is within the storage occupied
|
| 1804 |
-
by *Y*, an object that is pointer-interconvertible with *Y*, or the
|
| 1805 |
-
immediately-enclosing array object if *Y* is an array element. The
|
| 1806 |
-
program is ill-formed if `T` is a function type or cv `void`.
|
| 1807 |
-
|
| 1808 |
-
[*Note 1*: If a new object is created in storage occupied by an
|
| 1809 |
-
existing object of the same type, a pointer to the original object can
|
| 1810 |
-
be used to refer to the new object unless the type contains `const` or
|
| 1811 |
-
reference members; in the latter cases, this function can be used to
|
| 1812 |
-
obtain a usable pointer to the new object.
|
| 1813 |
-
See [[basic.life]]. — *end note*]
|
| 1814 |
-
|
| 1815 |
-
[*Example 1*:
|
| 1816 |
-
|
| 1817 |
-
``` cpp
|
| 1818 |
-
struct X { const int n; };
|
| 1819 |
-
X *p = new X{3};
|
| 1820 |
-
const int a = p->n;
|
| 1821 |
-
new (p) X{5}; // p does not point to new object ([basic.life]) because X::n is const
|
| 1822 |
-
const int b = p->n; // undefined behavior
|
| 1823 |
-
const int c = std::launder(p)->n; // OK
|
| 1824 |
-
```
|
| 1825 |
-
|
| 1826 |
-
— *end example*]
|
| 1827 |
-
|
| 1828 |
-
### Hardware interference size <a id="hardware.interference">[[hardware.interference]]</a>
|
| 1829 |
-
|
| 1830 |
-
``` cpp
|
| 1831 |
-
inline constexpr size_t hardware_destructive_interference_size = implementation-defined{};
|
| 1832 |
-
```
|
| 1833 |
-
|
| 1834 |
-
This number is the minimum recommended offset between two
|
| 1835 |
-
concurrently-accessed objects to avoid additional performance
|
| 1836 |
-
degradation due to contention introduced by the implementation. It shall
|
| 1837 |
-
be at least `alignof(max_align_t)`.
|
| 1838 |
-
|
| 1839 |
-
[*Example 1*:
|
| 1840 |
-
|
| 1841 |
-
``` cpp
|
| 1842 |
-
struct keep_apart {
|
| 1843 |
-
alignas(hardware_destructive_interference_size) atomic<int> cat;
|
| 1844 |
-
alignas(hardware_destructive_interference_size) atomic<int> dog;
|
| 1845 |
-
};
|
| 1846 |
-
```
|
| 1847 |
-
|
| 1848 |
-
— *end example*]
|
| 1849 |
-
|
| 1850 |
-
``` cpp
|
| 1851 |
-
inline constexpr size_t hardware_constructive_interference_size = implementation-defined{};
|
| 1852 |
-
```
|
| 1853 |
-
|
| 1854 |
-
This number is the maximum recommended size of contiguous memory
|
| 1855 |
-
occupied by two objects accessed with temporal locality by concurrent
|
| 1856 |
-
threads. It shall be at least `alignof(max_align_t)`.
|
| 1857 |
-
|
| 1858 |
-
[*Example 2*:
|
| 1859 |
-
|
| 1860 |
-
``` cpp
|
| 1861 |
-
struct together {
|
| 1862 |
-
atomic<int> dog;
|
| 1863 |
-
int puppy;
|
| 1864 |
-
};
|
| 1865 |
-
struct kennel {
|
| 1866 |
-
// Other data members...
|
| 1867 |
-
alignas(sizeof(together)) together pack;
|
| 1868 |
-
// Other data members...
|
| 1869 |
-
};
|
| 1870 |
-
static_assert(sizeof(together) <= hardware_constructive_interference_size);
|
| 1871 |
-
```
|
| 1872 |
-
|
| 1873 |
-
— *end example*]
|
| 1874 |
-
|
| 1875 |
-
## Type identification <a id="support.rtti">[[support.rtti]]</a>
|
| 1876 |
-
|
| 1877 |
-
The header `<typeinfo>` defines a type associated with type information
|
| 1878 |
-
generated by the implementation. It also defines two types for reporting
|
| 1879 |
-
dynamic type identification errors.
|
| 1880 |
-
|
| 1881 |
-
### Header `<typeinfo>` synopsis <a id="typeinfo.syn">[[typeinfo.syn]]</a>
|
| 1882 |
-
|
| 1883 |
-
``` cpp
|
| 1884 |
-
namespace std {
|
| 1885 |
-
class type_info;
|
| 1886 |
-
class bad_cast;
|
| 1887 |
-
class bad_typeid;
|
| 1888 |
-
}
|
| 1889 |
-
```
|
| 1890 |
-
|
| 1891 |
-
[[expr.dynamic.cast]], [[expr.typeid]].
|
| 1892 |
-
|
| 1893 |
-
### Class `type_info` <a id="type.info">[[type.info]]</a>
|
| 1894 |
-
|
| 1895 |
-
``` cpp
|
| 1896 |
-
namespace std {
|
| 1897 |
-
class type_info {
|
| 1898 |
-
public:
|
| 1899 |
-
virtual ~type_info();
|
| 1900 |
-
bool operator==(const type_info& rhs) const noexcept;
|
| 1901 |
-
bool operator!=(const type_info& rhs) const noexcept;
|
| 1902 |
-
bool before(const type_info& rhs) const noexcept;
|
| 1903 |
-
size_t hash_code() const noexcept;
|
| 1904 |
-
const char* name() const noexcept;
|
| 1905 |
-
|
| 1906 |
-
type_info(const type_info& rhs) = delete; // cannot be copied
|
| 1907 |
-
type_info& operator=(const type_info& rhs) = delete; // cannot be copied
|
| 1908 |
-
};
|
| 1909 |
-
}
|
| 1910 |
-
```
|
| 1911 |
-
|
| 1912 |
-
The class `type_info` describes type information generated by the
|
| 1913 |
-
implementation. Objects of this class effectively store a pointer to a
|
| 1914 |
-
name for the type, and an encoded value suitable for comparing two types
|
| 1915 |
-
for equality or collating order. The names, encoding rule, and collating
|
| 1916 |
-
sequence for types are all unspecified and may differ between programs.
|
| 1917 |
-
|
| 1918 |
-
``` cpp
|
| 1919 |
-
bool operator==(const type_info& rhs) const noexcept;
|
| 1920 |
-
```
|
| 1921 |
-
|
| 1922 |
-
*Effects:* Compares the current object with `rhs`.
|
| 1923 |
-
|
| 1924 |
-
*Returns:* `true` if the two values describe the same type.
|
| 1925 |
-
|
| 1926 |
-
``` cpp
|
| 1927 |
-
bool operator!=(const type_info& rhs) const noexcept;
|
| 1928 |
-
```
|
| 1929 |
-
|
| 1930 |
-
*Returns:* `!(*this == rhs)`.
|
| 1931 |
-
|
| 1932 |
-
``` cpp
|
| 1933 |
-
bool before(const type_info& rhs) const noexcept;
|
| 1934 |
-
```
|
| 1935 |
-
|
| 1936 |
-
*Effects:* Compares the current object with `rhs`.
|
| 1937 |
-
|
| 1938 |
-
*Returns:* `true` if `*this` precedes `rhs` in the implementation’s
|
| 1939 |
-
collation order.
|
| 1940 |
-
|
| 1941 |
-
``` cpp
|
| 1942 |
-
size_t hash_code() const noexcept;
|
| 1943 |
-
```
|
| 1944 |
-
|
| 1945 |
-
*Returns:* An unspecified value, except that within a single execution
|
| 1946 |
-
of the program, it shall return the same value for any two `type_info`
|
| 1947 |
-
objects which compare equal.
|
| 1948 |
-
|
| 1949 |
-
*Remarks:* An implementation should return different values for two
|
| 1950 |
-
`type_info` objects which do not compare equal.
|
| 1951 |
-
|
| 1952 |
-
``` cpp
|
| 1953 |
-
const char* name() const noexcept;
|
| 1954 |
-
```
|
| 1955 |
-
|
| 1956 |
-
*Returns:* An *implementation-defined* NTBS.
|
| 1957 |
-
|
| 1958 |
-
*Remarks:* The message may be a null-terminated multibyte
|
| 1959 |
-
string ([[multibyte.strings]]), suitable for conversion and display as
|
| 1960 |
-
a `wstring` ([[string.classes]], [[locale.codecvt]])
|
| 1961 |
-
|
| 1962 |
-
### Class `bad_cast` <a id="bad.cast">[[bad.cast]]</a>
|
| 1963 |
-
|
| 1964 |
-
``` cpp
|
| 1965 |
-
namespace std {
|
| 1966 |
-
class bad_cast : public exception {
|
| 1967 |
-
public:
|
| 1968 |
-
bad_cast() noexcept;
|
| 1969 |
-
bad_cast(const bad_cast&) noexcept;
|
| 1970 |
-
bad_cast& operator=(const bad_cast&) noexcept;
|
| 1971 |
-
const char* what() const noexcept override;
|
| 1972 |
-
};
|
| 1973 |
-
}
|
| 1974 |
-
```
|
| 1975 |
-
|
| 1976 |
-
The class `bad_cast` defines the type of objects thrown as exceptions by
|
| 1977 |
-
the implementation to report the execution of an invalid `dynamic_cast`
|
| 1978 |
-
expression ([[expr.dynamic.cast]]).
|
| 1979 |
-
|
| 1980 |
-
``` cpp
|
| 1981 |
-
bad_cast() noexcept;
|
| 1982 |
-
```
|
| 1983 |
-
|
| 1984 |
-
*Effects:* Constructs an object of class `bad_cast`.
|
| 1985 |
-
|
| 1986 |
-
``` cpp
|
| 1987 |
-
bad_cast(const bad_cast&) noexcept;
|
| 1988 |
-
bad_cast& operator=(const bad_cast&) noexcept;
|
| 1989 |
-
```
|
| 1990 |
-
|
| 1991 |
-
*Effects:* Copies an object of class `bad_cast`.
|
| 1992 |
-
|
| 1993 |
-
``` cpp
|
| 1994 |
-
const char* what() const noexcept override;
|
| 1995 |
-
```
|
| 1996 |
-
|
| 1997 |
-
*Returns:* An *implementation-defined* NTBS.
|
| 1998 |
-
|
| 1999 |
-
*Remarks:* The message may be a null-terminated multibyte
|
| 2000 |
-
string ([[multibyte.strings]]), suitable for conversion and display as
|
| 2001 |
-
a `wstring` ([[string.classes]], [[locale.codecvt]])
|
| 2002 |
-
|
| 2003 |
-
### Class `bad_typeid` <a id="bad.typeid">[[bad.typeid]]</a>
|
| 2004 |
-
|
| 2005 |
-
``` cpp
|
| 2006 |
-
namespace std {
|
| 2007 |
-
class bad_typeid : public exception {
|
| 2008 |
-
public:
|
| 2009 |
-
bad_typeid() noexcept;
|
| 2010 |
-
bad_typeid(const bad_typeid&) noexcept;
|
| 2011 |
-
bad_typeid& operator=(const bad_typeid&) noexcept;
|
| 2012 |
-
const char* what() const noexcept override;
|
| 2013 |
-
};
|
| 2014 |
-
}
|
| 2015 |
-
```
|
| 2016 |
-
|
| 2017 |
-
The class `bad_typeid` defines the type of objects thrown as exceptions
|
| 2018 |
-
by the implementation to report a null pointer in a `typeid`
|
| 2019 |
-
expression ([[expr.typeid]]).
|
| 2020 |
-
|
| 2021 |
-
``` cpp
|
| 2022 |
-
bad_typeid() noexcept;
|
| 2023 |
-
```
|
| 2024 |
-
|
| 2025 |
-
*Effects:* Constructs an object of class `bad_typeid`.
|
| 2026 |
-
|
| 2027 |
-
``` cpp
|
| 2028 |
-
bad_typeid(const bad_typeid&) noexcept;
|
| 2029 |
-
bad_typeid& operator=(const bad_typeid&) noexcept;
|
| 2030 |
-
```
|
| 2031 |
-
|
| 2032 |
-
*Effects:* Copies an object of class `bad_typeid`.
|
| 2033 |
-
|
| 2034 |
-
``` cpp
|
| 2035 |
-
const char* what() const noexcept override;
|
| 2036 |
-
```
|
| 2037 |
-
|
| 2038 |
-
*Returns:* An *implementation-defined* NTBS.
|
| 2039 |
-
|
| 2040 |
-
*Remarks:* The message may be a null-terminated multibyte
|
| 2041 |
-
string ([[multibyte.strings]]), suitable for conversion and display as
|
| 2042 |
-
a `wstring` ([[string.classes]], [[locale.codecvt]])
|
| 2043 |
-
|
| 2044 |
-
## Exception handling <a id="support.exception">[[support.exception]]</a>
|
| 2045 |
-
|
| 2046 |
-
The header `<exception>` defines several types and functions related to
|
| 2047 |
-
the handling of exceptions in a C++program.
|
| 2048 |
-
|
| 2049 |
-
### Header `<exception>` synopsis <a id="exception.syn">[[exception.syn]]</a>
|
| 2050 |
-
|
| 2051 |
-
``` cpp
|
| 2052 |
-
namespace std {
|
| 2053 |
-
class exception;
|
| 2054 |
-
class bad_exception;
|
| 2055 |
-
class nested_exception;
|
| 2056 |
-
|
| 2057 |
-
using terminate_handler = void (*)();
|
| 2058 |
-
terminate_handler get_terminate() noexcept;
|
| 2059 |
-
terminate_handler set_terminate(terminate_handler f) noexcept;
|
| 2060 |
-
[[noreturn]] void terminate() noexcept;
|
| 2061 |
-
|
| 2062 |
-
int uncaught_exceptions() noexcept;
|
| 2063 |
-
|
| 2064 |
-
using exception_ptr = unspecified;
|
| 2065 |
-
|
| 2066 |
-
exception_ptr current_exception() noexcept;
|
| 2067 |
-
[[noreturn]] void rethrow_exception(exception_ptr p);
|
| 2068 |
-
template<class E> exception_ptr make_exception_ptr(E e) noexcept;
|
| 2069 |
-
|
| 2070 |
-
template <class T> [[noreturn]] void throw_with_nested(T&& t);
|
| 2071 |
-
template <class E> void rethrow_if_nested(const E& e);
|
| 2072 |
-
}
|
| 2073 |
-
```
|
| 2074 |
-
|
| 2075 |
-
[[except.special]].
|
| 2076 |
-
|
| 2077 |
-
### Class `exception` <a id="exception">[[exception]]</a>
|
| 2078 |
-
|
| 2079 |
-
``` cpp
|
| 2080 |
-
namespace std {
|
| 2081 |
-
class exception {
|
| 2082 |
-
public:
|
| 2083 |
-
exception() noexcept;
|
| 2084 |
-
exception(const exception&) noexcept;
|
| 2085 |
-
exception& operator=(const exception&) noexcept;
|
| 2086 |
-
virtual ~exception();
|
| 2087 |
-
virtual const char* what() const noexcept;
|
| 2088 |
-
};
|
| 2089 |
-
}
|
| 2090 |
-
```
|
| 2091 |
-
|
| 2092 |
-
The class `exception` defines the base class for the types of objects
|
| 2093 |
-
thrown as exceptions by C++standard library components, and certain
|
| 2094 |
-
expressions, to report errors detected during program execution.
|
| 2095 |
-
|
| 2096 |
-
Each standard library class `T` that derives from class `exception`
|
| 2097 |
-
shall have a publicly accessible copy constructor and a publicly
|
| 2098 |
-
accessible copy assignment operator that do not exit with an exception.
|
| 2099 |
-
These member functions shall meet the following postcondition: If two
|
| 2100 |
-
objects `lhs` and `rhs` both have dynamic type `T` and `lhs` is a copy
|
| 2101 |
-
of `rhs`, then `strcmp(lhs.what(), rhs.what())` shall equal 0.
|
| 2102 |
-
|
| 2103 |
-
``` cpp
|
| 2104 |
-
exception() noexcept;
|
| 2105 |
-
```
|
| 2106 |
-
|
| 2107 |
-
*Effects:* Constructs an object of class `exception`.
|
| 2108 |
-
|
| 2109 |
-
``` cpp
|
| 2110 |
-
exception(const exception& rhs) noexcept;
|
| 2111 |
-
exception& operator=(const exception& rhs) noexcept;
|
| 2112 |
-
```
|
| 2113 |
-
|
| 2114 |
-
*Effects:* Copies an `exception` object.
|
| 2115 |
-
|
| 2116 |
-
*Postconditions:* If `*this` and `rhs` both have dynamic type
|
| 2117 |
-
`exception` then the value of the expression
|
| 2118 |
-
`strcmp(what(), rhs.what())` shall equal 0.
|
| 2119 |
-
|
| 2120 |
-
``` cpp
|
| 2121 |
-
virtual ~exception();
|
| 2122 |
-
```
|
| 2123 |
-
|
| 2124 |
-
*Effects:* Destroys an object of class `exception`.
|
| 2125 |
-
|
| 2126 |
-
``` cpp
|
| 2127 |
-
virtual const char* what() const noexcept;
|
| 2128 |
-
```
|
| 2129 |
-
|
| 2130 |
-
*Returns:* An *implementation-defined* NTBS.
|
| 2131 |
-
|
| 2132 |
-
*Remarks:* The message may be a null-terminated multibyte
|
| 2133 |
-
string ([[multibyte.strings]]), suitable for conversion and display as
|
| 2134 |
-
a `wstring` ([[string.classes]], [[locale.codecvt]]). The return value
|
| 2135 |
-
remains valid until the exception object from which it is obtained is
|
| 2136 |
-
destroyed or a non-`const` member function of the exception object is
|
| 2137 |
-
called.
|
| 2138 |
-
|
| 2139 |
-
### Class `bad_exception` <a id="bad.exception">[[bad.exception]]</a>
|
| 2140 |
-
|
| 2141 |
-
``` cpp
|
| 2142 |
-
namespace std {
|
| 2143 |
-
class bad_exception : public exception {
|
| 2144 |
-
public:
|
| 2145 |
-
bad_exception() noexcept;
|
| 2146 |
-
bad_exception(const bad_exception&) noexcept;
|
| 2147 |
-
bad_exception& operator=(const bad_exception&) noexcept;
|
| 2148 |
-
const char* what() const noexcept override;
|
| 2149 |
-
};
|
| 2150 |
-
}
|
| 2151 |
-
```
|
| 2152 |
-
|
| 2153 |
-
The class `bad_exception` defines the type of the object referenced by
|
| 2154 |
-
the `exception_ptr` returned from a call to `current_exception` (
|
| 2155 |
-
[[propagation]]) when the currently active exception object fails to
|
| 2156 |
-
copy.
|
| 2157 |
-
|
| 2158 |
-
``` cpp
|
| 2159 |
-
bad_exception() noexcept;
|
| 2160 |
-
```
|
| 2161 |
-
|
| 2162 |
-
*Effects:* Constructs an object of class `bad_exception`.
|
| 2163 |
-
|
| 2164 |
-
``` cpp
|
| 2165 |
-
bad_exception(const bad_exception&) noexcept;
|
| 2166 |
-
bad_exception& operator=(const bad_exception&) noexcept;
|
| 2167 |
-
```
|
| 2168 |
-
|
| 2169 |
-
*Effects:* Copies an object of class `bad_exception`.
|
| 2170 |
-
|
| 2171 |
-
``` cpp
|
| 2172 |
-
const char* what() const noexcept override;
|
| 2173 |
-
```
|
| 2174 |
-
|
| 2175 |
-
*Returns:* An *implementation-defined* NTBS.
|
| 2176 |
-
|
| 2177 |
-
*Remarks:* The message may be a null-terminated multibyte
|
| 2178 |
-
string ([[multibyte.strings]]), suitable for conversion and display as
|
| 2179 |
-
a `wstring` ([[string.classes]], [[locale.codecvt]]).
|
| 2180 |
-
|
| 2181 |
-
### Abnormal termination <a id="exception.terminate">[[exception.terminate]]</a>
|
| 2182 |
-
|
| 2183 |
-
#### Type `terminate_handler` <a id="terminate.handler">[[terminate.handler]]</a>
|
| 2184 |
-
|
| 2185 |
-
``` cpp
|
| 2186 |
-
using terminate_handler = void (*)();
|
| 2187 |
-
```
|
| 2188 |
-
|
| 2189 |
-
The type of a *handler function* to be called by `std::terminate()` when
|
| 2190 |
-
terminating exception processing.
|
| 2191 |
-
|
| 2192 |
-
*Required behavior:* A `terminate_handler` shall terminate execution of
|
| 2193 |
-
the program without returning to the caller.
|
| 2194 |
-
|
| 2195 |
-
*Default behavior:* The implementation’s default `terminate_handler`
|
| 2196 |
-
calls `abort()`.
|
| 2197 |
-
|
| 2198 |
-
#### `set_terminate` <a id="set.terminate">[[set.terminate]]</a>
|
| 2199 |
-
|
| 2200 |
-
``` cpp
|
| 2201 |
-
terminate_handler set_terminate(terminate_handler f) noexcept;
|
| 2202 |
-
```
|
| 2203 |
-
|
| 2204 |
-
*Effects:* Establishes the function designated by `f` as the current
|
| 2205 |
-
handler function for terminating exception processing.
|
| 2206 |
-
|
| 2207 |
-
*Remarks:* It is unspecified whether a null pointer value designates the
|
| 2208 |
-
default `terminate_handler`.
|
| 2209 |
-
|
| 2210 |
-
*Returns:* The previous `terminate_handler`.
|
| 2211 |
-
|
| 2212 |
-
#### `get_terminate` <a id="get.terminate">[[get.terminate]]</a>
|
| 2213 |
-
|
| 2214 |
-
``` cpp
|
| 2215 |
-
terminate_handler get_terminate() noexcept;
|
| 2216 |
-
```
|
| 2217 |
-
|
| 2218 |
-
*Returns:* The current `terminate_handler`.
|
| 2219 |
-
|
| 2220 |
-
[*Note 1*: This may be a null pointer value. — *end note*]
|
| 2221 |
-
|
| 2222 |
-
#### `terminate` <a id="terminate">[[terminate]]</a>
|
| 2223 |
-
|
| 2224 |
-
``` cpp
|
| 2225 |
-
[[noreturn]] void terminate() noexcept;
|
| 2226 |
-
```
|
| 2227 |
-
|
| 2228 |
-
*Remarks:* Called by the implementation when exception handling must be
|
| 2229 |
-
abandoned for any of several reasons ([[except.terminate]]). May also
|
| 2230 |
-
be called directly by the program.
|
| 2231 |
-
|
| 2232 |
-
*Effects:* Calls a `terminate_handler` function. It is unspecified which
|
| 2233 |
-
`terminate_handler` function will be called if an exception is active
|
| 2234 |
-
during a call to `set_terminate`. Otherwise calls the current
|
| 2235 |
-
`terminate_handler` function.
|
| 2236 |
-
|
| 2237 |
-
[*Note 1*: A default `terminate_handler` is always considered a
|
| 2238 |
-
callable handler in this context. — *end note*]
|
| 2239 |
-
|
| 2240 |
-
### `uncaught_exceptions` <a id="uncaught.exceptions">[[uncaught.exceptions]]</a>
|
| 2241 |
-
|
| 2242 |
-
``` cpp
|
| 2243 |
-
int uncaught_exceptions() noexcept;
|
| 2244 |
-
```
|
| 2245 |
-
|
| 2246 |
-
*Returns:* The number of uncaught exceptions ([[except.uncaught]]).
|
| 2247 |
-
|
| 2248 |
-
*Remarks:* When `uncaught_exceptions() > 0`, throwing an exception can
|
| 2249 |
-
result in a call of
|
| 2250 |
-
`std::terminate()` ([[except.terminate]]).
|
| 2251 |
-
|
| 2252 |
-
### Exception propagation <a id="propagation">[[propagation]]</a>
|
| 2253 |
-
|
| 2254 |
-
``` cpp
|
| 2255 |
-
using exception_ptr = unspecified;
|
| 2256 |
-
```
|
| 2257 |
-
|
| 2258 |
-
The type `exception_ptr` can be used to refer to an exception object.
|
| 2259 |
-
|
| 2260 |
-
`exception_ptr` shall satisfy the requirements of
|
| 2261 |
-
`NullablePointer` ([[nullablepointer.requirements]]).
|
| 2262 |
-
|
| 2263 |
-
Two non-null values of type `exception_ptr` are equivalent and compare
|
| 2264 |
-
equal if and only if they refer to the same exception.
|
| 2265 |
-
|
| 2266 |
-
The default constructor of `exception_ptr` produces the null value of
|
| 2267 |
-
the type.
|
| 2268 |
-
|
| 2269 |
-
`exception_ptr` shall not be implicitly convertible to any arithmetic,
|
| 2270 |
-
enumeration, or pointer type.
|
| 2271 |
-
|
| 2272 |
-
[*Note 1*: An implementation might use a reference-counted smart
|
| 2273 |
-
pointer as `exception_ptr`. — *end note*]
|
| 2274 |
-
|
| 2275 |
-
For purposes of determining the presence of a data race, operations on
|
| 2276 |
-
`exception_ptr` objects shall access and modify only the `exception_ptr`
|
| 2277 |
-
objects themselves and not the exceptions they refer to. Use of
|
| 2278 |
-
`rethrow_exception` on `exception_ptr` objects that refer to the same
|
| 2279 |
-
exception object shall not introduce a data race.
|
| 2280 |
-
|
| 2281 |
-
[*Note 2*: If `rethrow_exception` rethrows the same exception object
|
| 2282 |
-
(rather than a copy), concurrent access to that rethrown exception
|
| 2283 |
-
object may introduce a data race. Changes in the number of
|
| 2284 |
-
`exception_ptr` objects that refer to a particular exception do not
|
| 2285 |
-
introduce a data race. — *end note*]
|
| 2286 |
-
|
| 2287 |
-
``` cpp
|
| 2288 |
-
exception_ptr current_exception() noexcept;
|
| 2289 |
-
```
|
| 2290 |
-
|
| 2291 |
-
*Returns:* An `exception_ptr` object that refers to the currently
|
| 2292 |
-
handled exception ([[except.handle]]) or a copy of the currently
|
| 2293 |
-
handled exception, or a null `exception_ptr` object if no exception is
|
| 2294 |
-
being handled. The referenced object shall remain valid at least as long
|
| 2295 |
-
as there is an `exception_ptr` object that refers to it. If the function
|
| 2296 |
-
needs to allocate memory and the attempt fails, it returns an
|
| 2297 |
-
`exception_ptr` object that refers to an instance of `bad_alloc`. It is
|
| 2298 |
-
unspecified whether the return values of two successive calls to
|
| 2299 |
-
`current_exception` refer to the same exception object.
|
| 2300 |
-
|
| 2301 |
-
[*Note 3*: That is, it is unspecified whether `current_exception`
|
| 2302 |
-
creates a new copy each time it is called. — *end note*]
|
| 2303 |
-
|
| 2304 |
-
If the attempt to copy the current exception object throws an exception,
|
| 2305 |
-
the function returns an `exception_ptr` object that refers to the thrown
|
| 2306 |
-
exception or, if this is not possible, to an instance of
|
| 2307 |
-
`bad_exception`.
|
| 2308 |
-
|
| 2309 |
-
[*Note 4*: The copy constructor of the thrown exception may also fail,
|
| 2310 |
-
so the implementation is allowed to substitute a `bad_exception` object
|
| 2311 |
-
to avoid infinite recursion. — *end note*]
|
| 2312 |
-
|
| 2313 |
-
``` cpp
|
| 2314 |
-
[[noreturn]] void rethrow_exception(exception_ptr p);
|
| 2315 |
-
```
|
| 2316 |
-
|
| 2317 |
-
*Requires:* `p` shall not be a null pointer.
|
| 2318 |
-
|
| 2319 |
-
*Throws:* The exception object to which `p` refers.
|
| 2320 |
-
|
| 2321 |
-
``` cpp
|
| 2322 |
-
template<class E> exception_ptr make_exception_ptr(E e) noexcept;
|
| 2323 |
-
```
|
| 2324 |
-
|
| 2325 |
-
*Effects:* Creates an `exception_ptr` object that refers to a copy of
|
| 2326 |
-
`e`, as if:
|
| 2327 |
-
|
| 2328 |
-
``` cpp
|
| 2329 |
-
try {
|
| 2330 |
-
throw e;
|
| 2331 |
-
} catch(...) {
|
| 2332 |
-
return current_exception();
|
| 2333 |
-
}
|
| 2334 |
-
```
|
| 2335 |
-
|
| 2336 |
-
[*Note 5*: This function is provided for convenience and efficiency
|
| 2337 |
-
reasons. — *end note*]
|
| 2338 |
-
|
| 2339 |
-
### `nested_exception` <a id="except.nested">[[except.nested]]</a>
|
| 2340 |
-
|
| 2341 |
-
``` cpp
|
| 2342 |
-
namespace std {
|
| 2343 |
-
class nested_exception {
|
| 2344 |
-
public:
|
| 2345 |
-
nested_exception() noexcept;
|
| 2346 |
-
nested_exception(const nested_exception&) noexcept = default;
|
| 2347 |
-
nested_exception& operator=(const nested_exception&) noexcept = default;
|
| 2348 |
-
virtual ~nested_exception() = default;
|
| 2349 |
-
|
| 2350 |
-
// access functions
|
| 2351 |
-
[[noreturn]] void rethrow_nested() const;
|
| 2352 |
-
exception_ptr nested_ptr() const noexcept;
|
| 2353 |
-
};
|
| 2354 |
-
|
| 2355 |
-
template<class T> [[noreturn]] void throw_with_nested(T&& t);
|
| 2356 |
-
template <class E> void rethrow_if_nested(const E& e);
|
| 2357 |
-
}
|
| 2358 |
-
```
|
| 2359 |
-
|
| 2360 |
-
The class `nested_exception` is designed for use as a mixin through
|
| 2361 |
-
multiple inheritance. It captures the currently handled exception and
|
| 2362 |
-
stores it for later use.
|
| 2363 |
-
|
| 2364 |
-
[*Note 1*: `nested_exception` has a virtual destructor to make it a
|
| 2365 |
-
polymorphic class. Its presence can be tested for with
|
| 2366 |
-
`dynamic_cast`. — *end note*]
|
| 2367 |
-
|
| 2368 |
-
``` cpp
|
| 2369 |
-
nested_exception() noexcept;
|
| 2370 |
-
```
|
| 2371 |
-
|
| 2372 |
-
*Effects:* The constructor calls `current_exception()` and stores the
|
| 2373 |
-
returned value.
|
| 2374 |
-
|
| 2375 |
-
``` cpp
|
| 2376 |
-
[[noreturn]] void rethrow_nested() const;
|
| 2377 |
-
```
|
| 2378 |
-
|
| 2379 |
-
*Effects:* If `nested_ptr()` returns a null pointer, the function calls
|
| 2380 |
-
`std::terminate()`. Otherwise, it throws the stored exception captured
|
| 2381 |
-
by `*this`.
|
| 2382 |
-
|
| 2383 |
-
``` cpp
|
| 2384 |
-
exception_ptr nested_ptr() const noexcept;
|
| 2385 |
-
```
|
| 2386 |
-
|
| 2387 |
-
*Returns:* The stored exception captured by this `nested_exception`
|
| 2388 |
-
object.
|
| 2389 |
-
|
| 2390 |
-
``` cpp
|
| 2391 |
-
template <class T> [[noreturn]] void throw_with_nested(T&& t);
|
| 2392 |
-
```
|
| 2393 |
-
|
| 2394 |
-
Let `U` be `decay_t<T>`.
|
| 2395 |
-
|
| 2396 |
-
*Requires:* `U` shall be `CopyConstructible`.
|
| 2397 |
-
|
| 2398 |
-
*Throws:* If
|
| 2399 |
-
`is_class_v<U> && !is_final_v<U> && !is_base_of_v<nested_exception, U>`
|
| 2400 |
-
is `true`, an exception of unspecified type that is publicly derived
|
| 2401 |
-
from both `U` and `nested_exception` and constructed from
|
| 2402 |
-
`std::forward<T>(t)`, otherwise `std::forward<T>(t)`.
|
| 2403 |
-
|
| 2404 |
-
``` cpp
|
| 2405 |
-
template <class E> void rethrow_if_nested(const E& e);
|
| 2406 |
-
```
|
| 2407 |
-
|
| 2408 |
-
*Effects:* If `E` is not a polymorphic class type, or if
|
| 2409 |
-
`nested_exception` is an inaccessible or ambiguous base class of `E`,
|
| 2410 |
-
there is no effect. Otherwise, performs:
|
| 2411 |
-
|
| 2412 |
-
``` cpp
|
| 2413 |
-
if (auto p = dynamic_cast<const nested_exception*>(addressof(e)))
|
| 2414 |
-
p->rethrow_nested();
|
| 2415 |
-
```
|
| 2416 |
-
|
| 2417 |
-
## Initializer lists <a id="support.initlist">[[support.initlist]]</a>
|
| 2418 |
-
|
| 2419 |
-
The header `<initializer_list>` defines a class template and several
|
| 2420 |
-
support functions related to list-initialization (see
|
| 2421 |
-
[[dcl.init.list]]). All functions specified in this subclause are
|
| 2422 |
-
signal-safe ([[csignal.syn]]).
|
| 2423 |
-
|
| 2424 |
-
### Header `<initializer_list>` synopsis <a id="initializer_list.syn">[[initializer_list.syn]]</a>
|
| 2425 |
-
|
| 2426 |
-
``` cpp
|
| 2427 |
-
namespace std {
|
| 2428 |
-
template<class E> class initializer_list {
|
| 2429 |
-
public:
|
| 2430 |
-
using value_type = E;
|
| 2431 |
-
using reference = const E&;
|
| 2432 |
-
using const_reference = const E&;
|
| 2433 |
-
using size_type = size_t;
|
| 2434 |
-
|
| 2435 |
-
using iterator = const E*;
|
| 2436 |
-
using const_iterator = const E*;
|
| 2437 |
-
|
| 2438 |
-
constexpr initializer_list() noexcept;
|
| 2439 |
-
|
| 2440 |
-
constexpr size_t size() const noexcept; // number of elements
|
| 2441 |
-
constexpr const E* begin() const noexcept; // first element
|
| 2442 |
-
constexpr const E* end() const noexcept; // one past the last element
|
| 2443 |
-
};
|
| 2444 |
-
|
| 2445 |
-
// [support.initlist.range], initializer list range access
|
| 2446 |
-
template<class E> constexpr const E* begin(initializer_list<E> il) noexcept;
|
| 2447 |
-
template<class E> constexpr const E* end(initializer_list<E> il) noexcept;
|
| 2448 |
-
}
|
| 2449 |
-
```
|
| 2450 |
-
|
| 2451 |
-
An object of type `initializer_list<E>` provides access to an array of
|
| 2452 |
-
objects of type `const E`.
|
| 2453 |
-
|
| 2454 |
-
[*Note 1*: A pair of pointers or a pointer plus a length would be
|
| 2455 |
-
obvious representations for `initializer_list`. `initializer_list` is
|
| 2456 |
-
used to implement initializer lists as specified in [[dcl.init.list]].
|
| 2457 |
-
Copying an initializer list does not copy the underlying
|
| 2458 |
-
elements. — *end note*]
|
| 2459 |
-
|
| 2460 |
-
If an explicit specialization or partial specialization of
|
| 2461 |
-
`initializer_list` is declared, the program is ill-formed.
|
| 2462 |
-
|
| 2463 |
-
### Initializer list constructors <a id="support.initlist.cons">[[support.initlist.cons]]</a>
|
| 2464 |
-
|
| 2465 |
-
``` cpp
|
| 2466 |
-
constexpr initializer_list() noexcept;
|
| 2467 |
-
```
|
| 2468 |
-
|
| 2469 |
-
*Effects:* Constructs an empty `initializer_list` object.
|
| 2470 |
-
|
| 2471 |
-
*Postconditions:* `size() == 0`.
|
| 2472 |
-
|
| 2473 |
-
### Initializer list access <a id="support.initlist.access">[[support.initlist.access]]</a>
|
| 2474 |
-
|
| 2475 |
-
``` cpp
|
| 2476 |
-
constexpr const E* begin() const noexcept;
|
| 2477 |
-
```
|
| 2478 |
-
|
| 2479 |
-
*Returns:* A pointer to the beginning of the array. If `size() == 0` the
|
| 2480 |
-
values of `begin()` and `end()` are unspecified but they shall be
|
| 2481 |
-
identical.
|
| 2482 |
-
|
| 2483 |
-
``` cpp
|
| 2484 |
-
constexpr const E* end() const noexcept;
|
| 2485 |
-
```
|
| 2486 |
-
|
| 2487 |
-
*Returns:* `begin() + size()`.
|
| 2488 |
-
|
| 2489 |
-
``` cpp
|
| 2490 |
-
constexpr size_t size() const noexcept;
|
| 2491 |
-
```
|
| 2492 |
-
|
| 2493 |
-
*Returns:* The number of elements in the array.
|
| 2494 |
-
|
| 2495 |
-
*Complexity:* Constant time.
|
| 2496 |
-
|
| 2497 |
-
### Initializer list range access <a id="support.initlist.range">[[support.initlist.range]]</a>
|
| 2498 |
-
|
| 2499 |
-
``` cpp
|
| 2500 |
-
template<class E> constexpr const E* begin(initializer_list<E> il) noexcept;
|
| 2501 |
-
```
|
| 2502 |
-
|
| 2503 |
-
*Returns:* `il.begin()`.
|
| 2504 |
-
|
| 2505 |
-
``` cpp
|
| 2506 |
-
template<class E> constexpr const E* end(initializer_list<E> il) noexcept;
|
| 2507 |
-
```
|
| 2508 |
-
|
| 2509 |
-
*Returns:* `il.end()`.
|
| 2510 |
-
|
| 2511 |
-
## Other runtime support <a id="support.runtime">[[support.runtime]]</a>
|
| 2512 |
-
|
| 2513 |
-
Headers `<csetjmp>` (nonlocal jumps), `<csignal>` (signal handling),
|
| 2514 |
-
`<cstdarg>` (variable arguments), and `<cstdlib>` (runtime environment
|
| 2515 |
-
`getenv, system`), provide further compatibility with C code.
|
| 2516 |
-
|
| 2517 |
-
Calls to the function `getenv` ([[cstdlib.syn]]) shall not introduce a
|
| 2518 |
-
data race ([[res.on.data.races]]) provided that nothing modifies the
|
| 2519 |
-
environment.
|
| 2520 |
-
|
| 2521 |
-
[*Note 1*: Calls to the POSIX functions `setenv` and `putenv` modify
|
| 2522 |
-
the environment. — *end note*]
|
| 2523 |
-
|
| 2524 |
-
A call to the `setlocale` function ([[c.locales]]) may introduce a data
|
| 2525 |
-
race with other calls to the `setlocale` function or with calls to
|
| 2526 |
-
functions that are affected by the current C locale. The implementation
|
| 2527 |
-
shall behave as if no library function other than `locale::global` calls
|
| 2528 |
-
the `setlocale` function.
|
| 2529 |
-
|
| 2530 |
-
### Header `<cstdarg>` synopsis <a id="cstdarg.syn">[[cstdarg.syn]]</a>
|
| 2531 |
-
|
| 2532 |
-
``` cpp
|
| 2533 |
-
namespace std {
|
| 2534 |
-
using va_list = see below;
|
| 2535 |
-
}
|
| 2536 |
-
|
| 2537 |
-
#define va_arg(V, P) see below
|
| 2538 |
-
#define va_copy(VDST, VSRC) see below
|
| 2539 |
-
#define va_end(V) see below
|
| 2540 |
-
#define va_start(V, P) see below
|
| 2541 |
-
```
|
| 2542 |
-
|
| 2543 |
-
The contents of the header `<cstdarg>` are the same as the C standard
|
| 2544 |
-
library header `<stdarg.h>`, with the following changes: The
|
| 2545 |
-
restrictions that ISO C places on the second parameter to the `va_start`
|
| 2546 |
-
macro in header `<stdarg.h>` are different in this International
|
| 2547 |
-
Standard. The parameter `parmN` is the rightmost parameter in the
|
| 2548 |
-
variable parameter list of the function definition (the one just before
|
| 2549 |
-
the `...`).[^34] If the parameter `parmN` is a pack expansion (
|
| 2550 |
-
[[temp.variadic]]) or an entity resulting from a lambda capture (
|
| 2551 |
-
[[expr.prim.lambda]]), the program is ill-formed, no diagnostic
|
| 2552 |
-
required. If the parameter `parmN` is of a reference type, or of a type
|
| 2553 |
-
that is not compatible with the type that results when passing an
|
| 2554 |
-
argument for which there is no parameter, the behavior is undefined.
|
| 2555 |
-
|
| 2556 |
-
ISO C 7.16.1.1.
|
| 2557 |
-
|
| 2558 |
-
### Header `<csetjmp>` synopsis <a id="csetjmp.syn">[[csetjmp.syn]]</a>
|
| 2559 |
-
|
| 2560 |
-
``` cpp
|
| 2561 |
-
namespace std {
|
| 2562 |
-
using jmp_buf = see below;
|
| 2563 |
-
[[noreturn]] void longjmp(jmp_buf env, int val);
|
| 2564 |
-
}
|
| 2565 |
-
|
| 2566 |
-
#define setjmp(env) see below
|
| 2567 |
-
```
|
| 2568 |
-
|
| 2569 |
-
The contents of the header `<csetjmp>` are the same as the C standard
|
| 2570 |
-
library header `<setjmp.h>`.
|
| 2571 |
-
|
| 2572 |
-
The function signature `longjmp(jmp_buf jbuf, int val)` has more
|
| 2573 |
-
restricted behavior in this International Standard. A `setjmp`/`longjmp`
|
| 2574 |
-
call pair has undefined behavior if replacing the `setjmp` and `longjmp`
|
| 2575 |
-
by `catch` and `throw` would invoke any non-trivial destructors for any
|
| 2576 |
-
automatic objects.
|
| 2577 |
-
|
| 2578 |
-
ISO C 7.13.
|
| 2579 |
-
|
| 2580 |
-
### Header `<csignal>` synopsis <a id="csignal.syn">[[csignal.syn]]</a>
|
| 2581 |
-
|
| 2582 |
-
``` cpp
|
| 2583 |
-
namespace std {
|
| 2584 |
-
using sig_atomic_t = see below;
|
| 2585 |
-
|
| 2586 |
-
// [support.signal], signal handlers
|
| 2587 |
-
extern "C" using signal-handler = void(int); // exposition only
|
| 2588 |
-
signal-handler* signal(int sig, signal-handler* func);
|
| 2589 |
-
|
| 2590 |
-
int raise(int sig);
|
| 2591 |
-
}
|
| 2592 |
-
|
| 2593 |
-
#define SIG_DFL see below
|
| 2594 |
-
#define SIG_ERR see below
|
| 2595 |
-
#define SIG_IGN see below
|
| 2596 |
-
#define SIGABRT see below
|
| 2597 |
-
#define SIGFPE see below
|
| 2598 |
-
#define SIGILL see below
|
| 2599 |
-
#define SIGINT see below
|
| 2600 |
-
#define SIGSEGV see below
|
| 2601 |
-
#define SIGTERM see below
|
| 2602 |
-
```
|
| 2603 |
-
|
| 2604 |
-
The contents of the header `<csignal>` are the same as the C standard
|
| 2605 |
-
library header `<signal.h>`.
|
| 2606 |
-
|
| 2607 |
-
### Signal handlers <a id="support.signal">[[support.signal]]</a>
|
| 2608 |
-
|
| 2609 |
-
A call to the function `signal` synchronizes with any resulting
|
| 2610 |
-
invocation of the signal handler so installed.
|
| 2611 |
-
|
| 2612 |
-
A *plain lock-free atomic operation* is an invocation of a function `f`
|
| 2613 |
-
from Clause [[atomics]], such that:
|
| 2614 |
-
|
| 2615 |
-
- `f` is the function `atomic_is_lock_free()`, or
|
| 2616 |
-
- `f` is the member function `is_lock_free()`, or
|
| 2617 |
-
- `f` is a non-static member function invoked on an object `A`, such
|
| 2618 |
-
that `A.is_lock_free()` yields `true`, or
|
| 2619 |
-
- `f` is a non-member function, and for every pointer-to-atomic argument
|
| 2620 |
-
`A` passed to `f`, `atomic_is_lock_free(A)` yields `true`.
|
| 2621 |
-
|
| 2622 |
-
An evaluation is *signal-safe* unless it includes one of the following:
|
| 2623 |
-
|
| 2624 |
-
- a call to any standard library function, except for plain lock-free
|
| 2625 |
-
atomic operations and functions explicitly identified as signal-safe.
|
| 2626 |
-
\[*Note 1*: This implicitly excludes the use of `new` and `delete`
|
| 2627 |
-
expressions that rely on a library-provided memory
|
| 2628 |
-
allocator. — *end note*]
|
| 2629 |
-
- an access to an object with thread storage duration;
|
| 2630 |
-
- a `dynamic_cast` expression;
|
| 2631 |
-
- throwing of an exception;
|
| 2632 |
-
- control entering a *try-block* or *function-try-block*;
|
| 2633 |
-
- initialization of a variable with static storage duration requiring
|
| 2634 |
-
dynamic initialization ([[basic.start.dynamic]], [[stmt.dcl]]) [^35];
|
| 2635 |
-
or
|
| 2636 |
-
- waiting for the completion of the initialization of a variable with
|
| 2637 |
-
static storage duration ([[stmt.dcl]]).
|
| 2638 |
-
|
| 2639 |
-
A signal handler invocation has undefined behavior if it includes an
|
| 2640 |
-
evaluation that is not signal-safe.
|
| 2641 |
-
|
| 2642 |
-
The function `signal` is signal-safe if it is invoked with the first
|
| 2643 |
-
argument equal to the signal number corresponding to the signal that
|
| 2644 |
-
caused the invocation of the handler.
|
| 2645 |
-
|
| 2646 |
-
ISO C 7.14.
|
| 2647 |
-
|
| 2648 |
-
<!-- Link reference definitions -->
|
| 2649 |
-
[alg.c.library]: algorithms.md#alg.c.library
|
| 2650 |
-
[alloc.errors]: #alloc.errors
|
| 2651 |
-
[atomics]: atomics.md#atomics
|
| 2652 |
-
[bad.alloc]: #bad.alloc
|
| 2653 |
-
[bad.cast]: #bad.cast
|
| 2654 |
-
[bad.exception]: #bad.exception
|
| 2655 |
-
[bad.typeid]: #bad.typeid
|
| 2656 |
-
[basic.align]: basic.md#basic.align
|
| 2657 |
-
[basic.def.odr]: basic.md#basic.def.odr
|
| 2658 |
-
[basic.fundamental]: basic.md#basic.fundamental
|
| 2659 |
-
[basic.life]: basic.md#basic.life
|
| 2660 |
-
[basic.start]: basic.md#basic.start
|
| 2661 |
-
[basic.start.dynamic]: basic.md#basic.start.dynamic
|
| 2662 |
-
[basic.start.term]: basic.md#basic.start.term
|
| 2663 |
-
[basic.stc.dynamic]: basic.md#basic.stc.dynamic
|
| 2664 |
-
[basic.stc.dynamic.allocation]: basic.md#basic.stc.dynamic.allocation
|
| 2665 |
-
[basic.stc.dynamic.deallocation]: basic.md#basic.stc.dynamic.deallocation
|
| 2666 |
-
[basic.stc.dynamic.safety]: basic.md#basic.stc.dynamic.safety
|
| 2667 |
-
[c.locales]: localization.md#c.locales
|
| 2668 |
-
[c.malloc]: utilities.md#c.malloc
|
| 2669 |
-
[c.math.abs]: numerics.md#c.math.abs
|
| 2670 |
-
[c.math.rand]: numerics.md#c.math.rand
|
| 2671 |
-
[c.mb.wcs]: strings.md#c.mb.wcs
|
| 2672 |
-
[cfloat.syn]: #cfloat.syn
|
| 2673 |
-
[class]: class.md#class
|
| 2674 |
-
[class.free]: special.md#class.free
|
| 2675 |
-
[climits.syn]: #climits.syn
|
| 2676 |
-
[complex]: numerics.md#complex
|
| 2677 |
-
[constraints]: library.md#constraints
|
| 2678 |
-
[conv.ptr]: conv.md#conv.ptr
|
| 2679 |
-
[conv.qual]: conv.md#conv.qual
|
| 2680 |
-
[conv.rank]: conv.md#conv.rank
|
| 2681 |
-
[csetjmp.syn]: #csetjmp.syn
|
| 2682 |
-
[csignal.syn]: #csignal.syn
|
| 2683 |
-
[cstdarg.syn]: #cstdarg.syn
|
| 2684 |
-
[cstddef.syn]: #cstddef.syn
|
| 2685 |
-
[cstdint]: #cstdint
|
| 2686 |
-
[cstdint.syn]: #cstdint.syn
|
| 2687 |
-
[cstdlib.syn]: #cstdlib.syn
|
| 2688 |
-
[dcl.init.list]: dcl.md#dcl.init.list
|
| 2689 |
-
[denorm.style]: #denorm.style
|
| 2690 |
-
[except.handle]: except.md#except.handle
|
| 2691 |
-
[except.nested]: #except.nested
|
| 2692 |
-
[except.special]: except.md#except.special
|
| 2693 |
-
[except.terminate]: except.md#except.terminate
|
| 2694 |
-
[except.uncaught]: except.md#except.uncaught
|
| 2695 |
-
[exception]: #exception
|
| 2696 |
-
[exception.syn]: #exception.syn
|
| 2697 |
-
[exception.terminate]: #exception.terminate
|
| 2698 |
-
[expr.add]: expr.md#expr.add
|
| 2699 |
-
[expr.delete]: expr.md#expr.delete
|
| 2700 |
-
[expr.dynamic.cast]: expr.md#expr.dynamic.cast
|
| 2701 |
-
[expr.new]: expr.md#expr.new
|
| 2702 |
-
[expr.prim.lambda]: expr.md#expr.prim.lambda
|
| 2703 |
-
[expr.sizeof]: expr.md#expr.sizeof
|
| 2704 |
-
[expr.typeid]: expr.md#expr.typeid
|
| 2705 |
-
[fp.style]: #fp.style
|
| 2706 |
-
[get.new.handler]: #get.new.handler
|
| 2707 |
-
[get.terminate]: #get.terminate
|
| 2708 |
-
[hardware.interference]: #hardware.interference
|
| 2709 |
-
[initializer_list.syn]: #initializer_list.syn
|
| 2710 |
-
[intro.memory]: intro.md#intro.memory
|
| 2711 |
-
[intro.multithread]: intro.md#intro.multithread
|
| 2712 |
-
[language.support]: #language.support
|
| 2713 |
-
[library.c]: library.md#library.c
|
| 2714 |
-
[limits.syn]: #limits.syn
|
| 2715 |
-
[locale.codecvt]: localization.md#locale.codecvt
|
| 2716 |
-
[memory]: utilities.md#memory
|
| 2717 |
-
[multibyte.strings]: library.md#multibyte.strings
|
| 2718 |
-
[new.badlength]: #new.badlength
|
| 2719 |
-
[new.delete]: #new.delete
|
| 2720 |
-
[new.delete.array]: #new.delete.array
|
| 2721 |
-
[new.delete.dataraces]: #new.delete.dataraces
|
| 2722 |
-
[new.delete.placement]: #new.delete.placement
|
| 2723 |
-
[new.delete.single]: #new.delete.single
|
| 2724 |
-
[new.handler]: #new.handler
|
| 2725 |
-
[new.syn]: #new.syn
|
| 2726 |
-
[nullablepointer.requirements]: library.md#nullablepointer.requirements
|
| 2727 |
-
[numeric.limits]: #numeric.limits
|
| 2728 |
-
[numeric.limits.members]: #numeric.limits.members
|
| 2729 |
-
[numeric.special]: #numeric.special
|
| 2730 |
-
[propagation]: #propagation
|
| 2731 |
-
[ptr.launder]: #ptr.launder
|
| 2732 |
-
[res.on.data.races]: library.md#res.on.data.races
|
| 2733 |
-
[round.style]: #round.style
|
| 2734 |
-
[set.new.handler]: #set.new.handler
|
| 2735 |
-
[set.terminate]: #set.terminate
|
| 2736 |
-
[stmt.dcl]: stmt.md#stmt.dcl
|
| 2737 |
-
[string.classes]: strings.md#string.classes
|
| 2738 |
-
[support.dynamic]: #support.dynamic
|
| 2739 |
-
[support.exception]: #support.exception
|
| 2740 |
-
[support.general]: #support.general
|
| 2741 |
-
[support.initlist]: #support.initlist
|
| 2742 |
-
[support.initlist.access]: #support.initlist.access
|
| 2743 |
-
[support.initlist.cons]: #support.initlist.cons
|
| 2744 |
-
[support.initlist.range]: #support.initlist.range
|
| 2745 |
-
[support.limits]: #support.limits
|
| 2746 |
-
[support.limits.general]: #support.limits.general
|
| 2747 |
-
[support.rtti]: #support.rtti
|
| 2748 |
-
[support.runtime]: #support.runtime
|
| 2749 |
-
[support.signal]: #support.signal
|
| 2750 |
-
[support.start.term]: #support.start.term
|
| 2751 |
-
[support.types]: #support.types
|
| 2752 |
-
[support.types.byteops]: #support.types.byteops
|
| 2753 |
-
[support.types.layout]: #support.types.layout
|
| 2754 |
-
[support.types.nullptr]: #support.types.nullptr
|
| 2755 |
-
[tab:lang.sup.lib.summary]: #tab:lang.sup.lib.summary
|
| 2756 |
-
[temp.dep.constexpr]: temp.md#temp.dep.constexpr
|
| 2757 |
-
[temp.dep.expr]: temp.md#temp.dep.expr
|
| 2758 |
-
[temp.variadic]: temp.md#temp.variadic
|
| 2759 |
-
[terminate]: #terminate
|
| 2760 |
-
[terminate.handler]: #terminate.handler
|
| 2761 |
-
[type.info]: #type.info
|
| 2762 |
-
[typeinfo.syn]: #typeinfo.syn
|
| 2763 |
-
[uncaught.exceptions]: #uncaught.exceptions
|
| 2764 |
-
|
| 2765 |
-
[^1]: Possible definitions include `0` and `0L`, but not `(void*)0`.
|
| 2766 |
-
|
| 2767 |
-
[^2]: Note that `offsetof` is required to work as specified even if
|
| 2768 |
-
unary `operator&` is overloaded for any of the types involved.
|
| 2769 |
-
|
| 2770 |
-
[^3]: Equivalent to `CHAR_MIN`, `SHRT_MIN`, `FLT_MIN`, `DBL_MIN`, etc.
|
| 2771 |
-
|
| 2772 |
-
[^4]: Equivalent to `CHAR_MAX`, `SHRT_MAX`, `FLT_MAX`, `DBL_MAX`, etc.
|
| 2773 |
-
|
| 2774 |
-
[^5]: `lowest()` is necessary because not all floating-point
|
| 2775 |
-
representations have a smallest (most negative) value that is the
|
| 2776 |
-
negative of the largest (most positive) finite value.
|
| 2777 |
-
|
| 2778 |
-
[^6]: Equivalent to `FLT_MANT_DIG`, `DBL_MANT_DIG`, `LDBL_MANT_DIG`.
|
| 2779 |
-
|
| 2780 |
-
[^7]: Equivalent to `FLT_DIG`, `DBL_DIG`, `LDBL_DIG`.
|
| 2781 |
-
|
| 2782 |
-
[^8]: Equivalent to `FLT_RADIX`.
|
| 2783 |
-
|
| 2784 |
-
[^9]: Distinguishes types with bases other than 2 (e.g. BCD).
|
| 2785 |
-
|
| 2786 |
-
[^10]: Equivalent to `FLT_EPSILON`, `DBL_EPSILON`, `LDBL_EPSILON`.
|
| 2787 |
-
|
| 2788 |
-
[^11]: Rounding error is described in LIA-1 Section 5.2.4 and Annex C
|
| 2789 |
-
Rationale Section C.5.2.4 — Rounding and rounding constants.
|
| 2790 |
-
|
| 2791 |
-
[^12]: Equivalent to `FLT_MIN_EXP`, `DBL_MIN_EXP`, `LDBL_MIN_EXP`.
|
| 2792 |
-
|
| 2793 |
-
[^13]: Equivalent to `FLT_MIN_10_EXP`, `DBL_MIN_10_EXP`,
|
| 2794 |
-
`LDBL_MIN_10_EXP`.
|
| 2795 |
-
|
| 2796 |
-
[^14]: Equivalent to `FLT_MAX_EXP`, `DBL_MAX_EXP`, `LDBL_MAX_EXP`.
|
| 2797 |
-
|
| 2798 |
-
[^15]: Equivalent to `FLT_MAX_10_EXP`, `DBL_MAX_10_EXP`,
|
| 2799 |
-
`LDBL_MAX_10_EXP`.
|
| 2800 |
-
|
| 2801 |
-
[^16]: Required by LIA-1.
|
| 2802 |
-
|
| 2803 |
-
[^17]: Required by LIA-1.
|
| 2804 |
-
|
| 2805 |
-
[^18]: Required by LIA-1.
|
| 2806 |
-
|
| 2807 |
-
[^19]: See ISO/IEC/IEEE 60559.
|
| 2808 |
-
|
| 2809 |
-
[^20]: Required by LIA-1.
|
| 2810 |
-
|
| 2811 |
-
[^21]: Required by LIA-1.
|
| 2812 |
-
|
| 2813 |
-
[^22]: Required by LIA-1.
|
| 2814 |
-
|
| 2815 |
-
[^23]: Required by LIA-1.
|
| 2816 |
-
|
| 2817 |
-
[^24]: ISO/IEC/IEEE 60559:2011 is the same as IEEE 754-2008.
|
| 2818 |
-
|
| 2819 |
-
[^25]: Required by LIA-1.
|
| 2820 |
-
|
| 2821 |
-
[^26]: Required by LIA-1.
|
| 2822 |
-
|
| 2823 |
-
[^27]: Required by LIA-1.
|
| 2824 |
-
|
| 2825 |
-
[^28]: Refer to ISO/IEC/IEEE 60559. Required by LIA-1.
|
| 2826 |
-
|
| 2827 |
-
[^29]: Equivalent to `FLT_ROUNDS`. Required by LIA-1.
|
| 2828 |
-
|
| 2829 |
-
[^30]: A function is called for every time it is registered.
|
| 2830 |
-
|
| 2831 |
-
[^31]: Objects with automatic storage duration are all destroyed in a
|
| 2832 |
-
program whose `main` function ([[basic.start.main]]) contains no
|
| 2833 |
-
automatic objects and executes the call to `exit()`. Control can be
|
| 2834 |
-
transferred directly to such a `main` function by throwing an
|
| 2835 |
-
exception that is caught in `main`.
|
| 2836 |
-
|
| 2837 |
-
[^32]: The macros `EXIT_FAILURE` and `EXIT_SUCCESS` are defined in
|
| 2838 |
-
`<cstdlib>`.
|
| 2839 |
-
|
| 2840 |
-
[^33]: It is not the direct responsibility of `operator new[]` or
|
| 2841 |
-
`operator delete[]` to note the repetition count or element size of
|
| 2842 |
-
the array. Those operations are performed elsewhere in the array
|
| 2843 |
-
`new` and `delete` expressions. The array `new` expression, may,
|
| 2844 |
-
however, increase the `size` argument to `operator new[]` to obtain
|
| 2845 |
-
space to store supplemental information.
|
| 2846 |
-
|
| 2847 |
-
[^34]: Note that `va_start` is required to work as specified even if
|
| 2848 |
-
unary `operator&` is overloaded for the type of `parmN`.
|
| 2849 |
-
|
| 2850 |
-
[^35]: Such initialization might occur because it is the first odr-use (
|
| 2851 |
-
[[basic.def.odr]]) of that variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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