- tmp/tmpp0nirck9/{from.md → to.md} +251 -154
tmp/tmpp0nirck9/{from.md → to.md}
RENAMED
|
@@ -17,10 +17,11 @@ in [[diagnostics.summary]].
|
|
| 17 |
| [[std.exceptions]] | Exception classes | `<stdexcept>` |
|
| 18 |
| [[assertions]] | Assertions | `<cassert>` |
|
| 19 |
| [[errno]] | Error numbers | `<cerrno>` |
|
| 20 |
| [[syserr]] | System error support | `<system_error>` |
|
| 21 |
| [[stacktrace]] | Stacktrace | `<stacktrace>` |
|
|
|
|
| 22 |
|
| 23 |
|
| 24 |
## Exception classes <a id="std.exceptions">[[std.exceptions]]</a>
|
| 25 |
|
| 26 |
### General <a id="std.exceptions.general">[[std.exceptions.general]]</a>
|
|
@@ -60,270 +61,291 @@ namespace std {
|
|
| 60 |
|
| 61 |
``` cpp
|
| 62 |
namespace std {
|
| 63 |
class logic_error : public exception {
|
| 64 |
public:
|
| 65 |
-
explicit logic_error(const string& what_arg);
|
| 66 |
-
explicit logic_error(const char* what_arg);
|
| 67 |
};
|
| 68 |
}
|
| 69 |
```
|
| 70 |
|
| 71 |
The class `logic_error` defines the type of objects thrown as exceptions
|
| 72 |
to report errors presumably detectable before the program executes, such
|
| 73 |
as violations of logical preconditions or class invariants.
|
| 74 |
|
| 75 |
``` cpp
|
| 76 |
-
logic_error(const string& what_arg);
|
| 77 |
```
|
| 78 |
|
| 79 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 80 |
|
| 81 |
``` cpp
|
| 82 |
-
logic_error(const char* what_arg);
|
| 83 |
```
|
| 84 |
|
| 85 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 86 |
|
| 87 |
### Class `domain_error` <a id="domain.error">[[domain.error]]</a>
|
| 88 |
|
| 89 |
``` cpp
|
| 90 |
namespace std {
|
| 91 |
class domain_error : public logic_error {
|
| 92 |
public:
|
| 93 |
-
explicit domain_error(const string& what_arg);
|
| 94 |
-
explicit domain_error(const char* what_arg);
|
| 95 |
};
|
| 96 |
}
|
| 97 |
```
|
| 98 |
|
| 99 |
The class `domain_error` defines the type of objects thrown as
|
| 100 |
exceptions by the implementation to report domain errors.
|
| 101 |
|
| 102 |
``` cpp
|
| 103 |
-
domain_error(const string& what_arg);
|
| 104 |
```
|
| 105 |
|
| 106 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 107 |
|
| 108 |
``` cpp
|
| 109 |
-
domain_error(const char* what_arg);
|
| 110 |
```
|
| 111 |
|
| 112 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 113 |
|
| 114 |
### Class `invalid_argument` <a id="invalid.argument">[[invalid.argument]]</a>
|
| 115 |
|
| 116 |
``` cpp
|
| 117 |
namespace std {
|
| 118 |
class invalid_argument : public logic_error {
|
| 119 |
public:
|
| 120 |
-
explicit invalid_argument(const string& what_arg);
|
| 121 |
-
explicit invalid_argument(const char* what_arg);
|
| 122 |
};
|
| 123 |
}
|
| 124 |
```
|
| 125 |
|
| 126 |
The class `invalid_argument` defines the type of objects thrown as
|
| 127 |
exceptions to report an invalid argument.
|
| 128 |
|
| 129 |
``` cpp
|
| 130 |
-
invalid_argument(const string& what_arg);
|
| 131 |
```
|
| 132 |
|
| 133 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 134 |
|
| 135 |
``` cpp
|
| 136 |
-
invalid_argument(const char* what_arg);
|
| 137 |
```
|
| 138 |
|
| 139 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 140 |
|
| 141 |
### Class `length_error` <a id="length.error">[[length.error]]</a>
|
| 142 |
|
| 143 |
``` cpp
|
| 144 |
namespace std {
|
| 145 |
class length_error : public logic_error {
|
| 146 |
public:
|
| 147 |
-
explicit length_error(const string& what_arg);
|
| 148 |
-
explicit length_error(const char* what_arg);
|
| 149 |
};
|
| 150 |
}
|
| 151 |
```
|
| 152 |
|
| 153 |
The class `length_error` defines the type of objects thrown as
|
| 154 |
exceptions to report an attempt to produce an object whose length
|
| 155 |
exceeds its maximum allowable size.
|
| 156 |
|
| 157 |
``` cpp
|
| 158 |
-
length_error(const string& what_arg);
|
| 159 |
```
|
| 160 |
|
| 161 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 162 |
|
| 163 |
``` cpp
|
| 164 |
-
length_error(const char* what_arg);
|
| 165 |
```
|
| 166 |
|
| 167 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 168 |
|
| 169 |
### Class `out_of_range` <a id="out.of.range">[[out.of.range]]</a>
|
| 170 |
|
| 171 |
``` cpp
|
| 172 |
namespace std {
|
| 173 |
class out_of_range : public logic_error {
|
| 174 |
public:
|
| 175 |
-
explicit out_of_range(const string& what_arg);
|
| 176 |
-
explicit out_of_range(const char* what_arg);
|
| 177 |
};
|
| 178 |
}
|
| 179 |
```
|
| 180 |
|
| 181 |
The class `out_of_range` defines the type of objects thrown as
|
| 182 |
exceptions to report an argument value not in its expected range.
|
| 183 |
|
| 184 |
``` cpp
|
| 185 |
-
out_of_range(const string& what_arg);
|
| 186 |
```
|
| 187 |
|
| 188 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 189 |
|
| 190 |
``` cpp
|
| 191 |
-
out_of_range(const char* what_arg);
|
| 192 |
```
|
| 193 |
|
| 194 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 195 |
|
| 196 |
### Class `runtime_error` <a id="runtime.error">[[runtime.error]]</a>
|
| 197 |
|
| 198 |
``` cpp
|
| 199 |
namespace std {
|
| 200 |
class runtime_error : public exception {
|
| 201 |
public:
|
| 202 |
-
explicit runtime_error(const string& what_arg);
|
| 203 |
-
explicit runtime_error(const char* what_arg);
|
| 204 |
};
|
| 205 |
}
|
| 206 |
```
|
| 207 |
|
| 208 |
The class `runtime_error` defines the type of objects thrown as
|
| 209 |
exceptions to report errors presumably detectable only when the program
|
| 210 |
executes.
|
| 211 |
|
| 212 |
``` cpp
|
| 213 |
-
runtime_error(const string& what_arg);
|
| 214 |
```
|
| 215 |
|
| 216 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 217 |
|
| 218 |
``` cpp
|
| 219 |
-
runtime_error(const char* what_arg);
|
| 220 |
```
|
| 221 |
|
| 222 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 223 |
|
| 224 |
### Class `range_error` <a id="range.error">[[range.error]]</a>
|
| 225 |
|
| 226 |
``` cpp
|
| 227 |
namespace std {
|
| 228 |
class range_error : public runtime_error {
|
| 229 |
public:
|
| 230 |
-
explicit range_error(const string& what_arg);
|
| 231 |
-
explicit range_error(const char* what_arg);
|
| 232 |
};
|
| 233 |
}
|
| 234 |
```
|
| 235 |
|
| 236 |
The class `range_error` defines the type of objects thrown as exceptions
|
| 237 |
to report range errors in internal computations.
|
| 238 |
|
| 239 |
``` cpp
|
| 240 |
-
range_error(const string& what_arg);
|
| 241 |
```
|
| 242 |
|
| 243 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 244 |
|
| 245 |
``` cpp
|
| 246 |
-
range_error(const char* what_arg);
|
| 247 |
```
|
| 248 |
|
| 249 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 250 |
|
| 251 |
### Class `overflow_error` <a id="overflow.error">[[overflow.error]]</a>
|
| 252 |
|
| 253 |
``` cpp
|
| 254 |
namespace std {
|
| 255 |
class overflow_error : public runtime_error {
|
| 256 |
public:
|
| 257 |
-
explicit overflow_error(const string& what_arg);
|
| 258 |
-
explicit overflow_error(const char* what_arg);
|
| 259 |
};
|
| 260 |
}
|
| 261 |
```
|
| 262 |
|
| 263 |
The class `overflow_error` defines the type of objects thrown as
|
| 264 |
exceptions to report an arithmetic overflow error.
|
| 265 |
|
| 266 |
``` cpp
|
| 267 |
-
overflow_error(const string& what_arg);
|
| 268 |
```
|
| 269 |
|
| 270 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 271 |
|
| 272 |
``` cpp
|
| 273 |
-
overflow_error(const char* what_arg);
|
| 274 |
```
|
| 275 |
|
| 276 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 277 |
|
| 278 |
### Class `underflow_error` <a id="underflow.error">[[underflow.error]]</a>
|
| 279 |
|
| 280 |
``` cpp
|
| 281 |
namespace std {
|
| 282 |
class underflow_error : public runtime_error {
|
| 283 |
public:
|
| 284 |
-
explicit underflow_error(const string& what_arg);
|
| 285 |
-
explicit underflow_error(const char* what_arg);
|
| 286 |
};
|
| 287 |
}
|
| 288 |
```
|
| 289 |
|
| 290 |
The class `underflow_error` defines the type of objects thrown as
|
| 291 |
exceptions to report an arithmetic underflow error.
|
| 292 |
|
| 293 |
``` cpp
|
| 294 |
-
underflow_error(const string& what_arg);
|
| 295 |
```
|
| 296 |
|
| 297 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 298 |
|
| 299 |
``` cpp
|
| 300 |
-
underflow_error(const char* what_arg);
|
| 301 |
```
|
| 302 |
|
| 303 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 304 |
|
| 305 |
## Assertions <a id="assertions">[[assertions]]</a>
|
| 306 |
|
| 307 |
### General <a id="assertions.general">[[assertions.general]]</a>
|
| 308 |
|
| 309 |
The header `<cassert>` provides a macro for documenting C++ program
|
| 310 |
-
assertions and a mechanism for disabling the assertion checks
|
|
|
|
| 311 |
|
| 312 |
### Header `<cassert>` synopsis <a id="cassert.syn">[[cassert.syn]]</a>
|
| 313 |
|
| 314 |
``` cpp
|
| 315 |
-
#define assert(
|
| 316 |
```
|
| 317 |
|
| 318 |
-
The contents are the same as the C standard library header `<assert.h>`,
|
| 319 |
-
except that a macro named `static_assert` is not defined.
|
| 320 |
-
|
| 321 |
-
See also: ISO C 7.2
|
| 322 |
-
|
| 323 |
### The `assert` macro <a id="assertions.assert">[[assertions.assert]]</a>
|
| 324 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
An expression `assert(E)` is a constant subexpression
|
| 326 |
[[defns.const.subexpr]], if
|
| 327 |
|
| 328 |
- `NDEBUG` is defined at the point where `assert` is last defined or
|
| 329 |
redefined, or
|
|
@@ -345,84 +367,84 @@ A separate `errno` value is provided for each thread.
|
|
| 345 |
### Header `<cerrno>` synopsis <a id="cerrno.syn">[[cerrno.syn]]</a>
|
| 346 |
|
| 347 |
``` cpp
|
| 348 |
#define errno see below
|
| 349 |
|
| 350 |
-
#define E2BIG see below
|
| 351 |
-
#define EACCES see below
|
| 352 |
-
#define EADDRINUSE see below
|
| 353 |
-
#define EADDRNOTAVAIL see below
|
| 354 |
-
#define EAFNOSUPPORT see below
|
| 355 |
-
#define EAGAIN see below
|
| 356 |
-
#define EALREADY see below
|
| 357 |
-
#define EBADF see below
|
| 358 |
-
#define EBADMSG see below
|
| 359 |
-
#define EBUSY see below
|
| 360 |
-
#define ECANCELED see below
|
| 361 |
-
#define ECHILD see below
|
| 362 |
-
#define ECONNABORTED see below
|
| 363 |
-
#define ECONNREFUSED see below
|
| 364 |
-
#define ECONNRESET see below
|
| 365 |
-
#define EDEADLK see below
|
| 366 |
-
#define EDESTADDRREQ see below
|
| 367 |
-
#define EDOM see below
|
| 368 |
-
#define EEXIST see below
|
| 369 |
-
#define EFAULT see below
|
| 370 |
-
#define EFBIG see below
|
| 371 |
-
#define EHOSTUNREACH see below
|
| 372 |
-
#define EIDRM see below
|
| 373 |
-
#define EILSEQ see below
|
| 374 |
-
#define EINPROGRESS see below
|
| 375 |
-
#define EINTR see below
|
| 376 |
-
#define EINVAL see below
|
| 377 |
-
#define EIO see below
|
| 378 |
-
#define EISCONN see below
|
| 379 |
-
#define EISDIR see below
|
| 380 |
-
#define ELOOP see below
|
| 381 |
-
#define EMFILE see below
|
| 382 |
-
#define EMLINK see below
|
| 383 |
-
#define EMSGSIZE see below
|
| 384 |
-
#define ENAMETOOLONG see below
|
| 385 |
-
#define ENETDOWN see below
|
| 386 |
-
#define ENETRESET see below
|
| 387 |
-
#define ENETUNREACH see below
|
| 388 |
-
#define ENFILE see below
|
| 389 |
-
#define ENOBUFS see below
|
| 390 |
-
#define ENODEV see below
|
| 391 |
-
#define ENOENT see below
|
| 392 |
-
#define ENOEXEC see below
|
| 393 |
-
#define ENOLCK see below
|
| 394 |
-
#define ENOLINK see below
|
| 395 |
-
#define ENOMEM see below
|
| 396 |
-
#define ENOMSG see below
|
| 397 |
-
#define ENOPROTOOPT see below
|
| 398 |
-
#define ENOSPC see below
|
| 399 |
-
#define ENOSYS see below
|
| 400 |
-
#define ENOTCONN see below
|
| 401 |
-
#define ENOTDIR see below
|
| 402 |
-
#define ENOTEMPTY see below
|
| 403 |
-
#define ENOTRECOVERABLE see below
|
| 404 |
-
#define ENOTSOCK see below
|
| 405 |
-
#define ENOTSUP see below
|
| 406 |
-
#define ENOTTY see below
|
| 407 |
-
#define ENXIO see below
|
| 408 |
-
#define EOPNOTSUPP see below
|
| 409 |
-
#define EOVERFLOW see below
|
| 410 |
-
#define EOWNERDEAD see below
|
| 411 |
-
#define EPERM see below
|
| 412 |
-
#define EPIPE see below
|
| 413 |
-
#define EPROTO see below
|
| 414 |
-
#define EPROTONOSUPPORT see below
|
| 415 |
-
#define EPROTOTYPE see below
|
| 416 |
-
#define ERANGE see below
|
| 417 |
-
#define EROFS see below
|
| 418 |
-
#define ESPIPE see below
|
| 419 |
-
#define ESRCH see below
|
| 420 |
-
#define ETIMEDOUT see below
|
| 421 |
-
#define ETXTBSY see below
|
| 422 |
-
#define EWOULDBLOCK see below
|
| 423 |
-
#define EXDEV see below
|
| 424 |
```
|
| 425 |
|
| 426 |
The meaning of the macros in this header is defined by the POSIX
|
| 427 |
standard.
|
| 428 |
|
|
@@ -460,11 +482,11 @@ namespace std {
|
|
| 460 |
struct is_error_code_enum : public false_type {};
|
| 461 |
|
| 462 |
template<class T>
|
| 463 |
struct is_error_condition_enum : public false_type {};
|
| 464 |
|
| 465 |
-
enum class errc {
|
| 466 |
address_family_not_supported, // EAFNOSUPPORT
|
| 467 |
address_in_use, // EADDRINUSE
|
| 468 |
address_not_available, // EADDRNOTAVAIL
|
| 469 |
already_connected, // EISCONN
|
| 470 |
argument_list_too_long, // E2BIG
|
|
@@ -789,18 +811,18 @@ namespace std {
|
|
| 789 |
|
| 790 |
``` cpp
|
| 791 |
error_code() noexcept;
|
| 792 |
```
|
| 793 |
|
| 794 |
-
*Effects:* Initializes
|
| 795 |
`&system_category()`.
|
| 796 |
|
| 797 |
``` cpp
|
| 798 |
error_code(int val, const error_category& cat) noexcept;
|
| 799 |
```
|
| 800 |
|
| 801 |
-
*Effects:* Initializes
|
| 802 |
|
| 803 |
``` cpp
|
| 804 |
template<class ErrorCodeEnum>
|
| 805 |
error_code(ErrorCodeEnum e) noexcept;
|
| 806 |
```
|
|
@@ -818,11 +840,11 @@ assign(ec.value(), ec.category());
|
|
| 818 |
|
| 819 |
``` cpp
|
| 820 |
void assign(int val, const error_category& cat) noexcept;
|
| 821 |
```
|
| 822 |
|
| 823 |
-
*Ensures:* `val_ == val` and `cat_ == &cat`.
|
| 824 |
|
| 825 |
``` cpp
|
| 826 |
template<class ErrorCodeEnum>
|
| 827 |
error_code& operator=(ErrorCodeEnum e) noexcept;
|
| 828 |
```
|
|
@@ -848,17 +870,17 @@ void clear() noexcept;
|
|
| 848 |
|
| 849 |
``` cpp
|
| 850 |
int value() const noexcept;
|
| 851 |
```
|
| 852 |
|
| 853 |
-
*Returns:*
|
| 854 |
|
| 855 |
``` cpp
|
| 856 |
const error_category& category() const noexcept;
|
| 857 |
```
|
| 858 |
|
| 859 |
-
*Returns:* `*cat_`.
|
| 860 |
|
| 861 |
``` cpp
|
| 862 |
error_condition default_error_condition() const noexcept;
|
| 863 |
```
|
| 864 |
|
|
@@ -936,18 +958,18 @@ namespace std {
|
|
| 936 |
|
| 937 |
``` cpp
|
| 938 |
error_condition() noexcept;
|
| 939 |
```
|
| 940 |
|
| 941 |
-
*Effects:* Initializes
|
| 942 |
`&generic_category()`.
|
| 943 |
|
| 944 |
``` cpp
|
| 945 |
error_condition(int val, const error_category& cat) noexcept;
|
| 946 |
```
|
| 947 |
|
| 948 |
-
*Effects:* Initializes
|
| 949 |
|
| 950 |
``` cpp
|
| 951 |
template<class ErrorConditionEnum>
|
| 952 |
error_condition(ErrorConditionEnum e) noexcept;
|
| 953 |
```
|
|
@@ -966,11 +988,11 @@ assign(ec.value(), ec.category());
|
|
| 966 |
|
| 967 |
``` cpp
|
| 968 |
void assign(int val, const error_category& cat) noexcept;
|
| 969 |
```
|
| 970 |
|
| 971 |
-
*Ensures:* `val_ == val` and `cat_ == &cat`.
|
| 972 |
|
| 973 |
``` cpp
|
| 974 |
template<class ErrorConditionEnum>
|
| 975 |
error_condition& operator=(ErrorConditionEnum e) noexcept;
|
| 976 |
```
|
|
@@ -997,17 +1019,17 @@ void clear() noexcept;
|
|
| 997 |
|
| 998 |
``` cpp
|
| 999 |
int value() const noexcept;
|
| 1000 |
```
|
| 1001 |
|
| 1002 |
-
*Returns:*
|
| 1003 |
|
| 1004 |
``` cpp
|
| 1005 |
const error_category& category() const noexcept;
|
| 1006 |
```
|
| 1007 |
|
| 1008 |
-
*Returns:* `*cat_`.
|
| 1009 |
|
| 1010 |
``` cpp
|
| 1011 |
string message() const;
|
| 1012 |
```
|
| 1013 |
|
|
@@ -1411,11 +1433,11 @@ namespace std {
|
|
| 1411 |
const_iterator cbegin() const noexcept;
|
| 1412 |
const_iterator cend() const noexcept;
|
| 1413 |
const_reverse_iterator crbegin() const noexcept;
|
| 1414 |
const_reverse_iterator crend() const noexcept;
|
| 1415 |
|
| 1416 |
-
|
| 1417 |
size_type size() const noexcept;
|
| 1418 |
size_type max_size() const noexcept;
|
| 1419 |
|
| 1420 |
const_reference operator[](size_type) const;
|
| 1421 |
const_reference at(size_type) const;
|
|
@@ -1453,48 +1475,49 @@ container [[container.alloc.reqmts]], and of a sequence container
|
|
| 1453 |
|
| 1454 |
``` cpp
|
| 1455 |
static basic_stacktrace current(const allocator_type& alloc = allocator_type()) noexcept;
|
| 1456 |
```
|
| 1457 |
|
| 1458 |
-
*Returns:* A `basic_stacktrace` object with
|
| 1459 |
stacktrace of the current evaluation in the current thread of execution,
|
| 1460 |
-
or an empty `basic_stacktrace` object if the initialization of
|
| 1461 |
-
failed. `alloc` is passed to the constructor of the
|
|
|
|
| 1462 |
|
| 1463 |
[*Note 1*: If the stacktrace was successfully obtained, then
|
| 1464 |
-
`frames_.front()` is the `stacktrace_entry` representing
|
| 1465 |
-
the current evaluation, and `frames_.back()` is the
|
| 1466 |
-
representing approximately the initial function of
|
| 1467 |
-
execution. — *end note*]
|
| 1468 |
|
| 1469 |
``` cpp
|
| 1470 |
static basic_stacktrace current(size_type skip,
|
| 1471 |
const allocator_type& alloc = allocator_type()) noexcept;
|
| 1472 |
```
|
| 1473 |
|
| 1474 |
Let `t` be a stacktrace as-if obtained via
|
| 1475 |
`basic_stacktrace::current(alloc)`. Let `n` be `t.size()`.
|
| 1476 |
|
| 1477 |
-
*Returns:* A `basic_stacktrace` object where
|
| 1478 |
direct-non-list-initialized from arguments `t.begin() + min(n, skip)`,
|
| 1479 |
`t.end()`, and `alloc`, or an empty `basic_stacktrace` object if the
|
| 1480 |
-
initialization of
|
| 1481 |
|
| 1482 |
``` cpp
|
| 1483 |
static basic_stacktrace current(size_type skip, size_type max_depth,
|
| 1484 |
const allocator_type& alloc = allocator_type()) noexcept;
|
| 1485 |
```
|
| 1486 |
|
| 1487 |
Let `t` be a stacktrace as-if obtained via
|
| 1488 |
`basic_stacktrace::current(alloc)`. Let `n` be `t.size()`.
|
| 1489 |
|
| 1490 |
-
|
| 1491 |
|
| 1492 |
-
*Returns:* A `basic_stacktrace` object where
|
| 1493 |
direct-non-list-initialized from arguments `t.begin() + min(n, skip)`,
|
| 1494 |
`t.begin() + min(n, skip + max_depth)`, and `alloc`, or an empty
|
| 1495 |
-
`basic_stacktrace` object if the initialization of
|
| 1496 |
|
| 1497 |
``` cpp
|
| 1498 |
basic_stacktrace() noexcept(is_nothrow_default_constructible_v<allocator_type>);
|
| 1499 |
```
|
| 1500 |
|
|
@@ -1502,11 +1525,11 @@ basic_stacktrace() noexcept(is_nothrow_default_constructible_v<allocator_type>);
|
|
| 1502 |
|
| 1503 |
``` cpp
|
| 1504 |
explicit basic_stacktrace(const allocator_type& alloc) noexcept;
|
| 1505 |
```
|
| 1506 |
|
| 1507 |
-
*Effects:* `alloc` is passed to the
|
| 1508 |
|
| 1509 |
*Ensures:* `empty()` is `true`.
|
| 1510 |
|
| 1511 |
``` cpp
|
| 1512 |
basic_stacktrace(const basic_stacktrace& other);
|
|
@@ -1534,18 +1557,18 @@ The type models `random_access_iterator`
|
|
| 1534 |
|
| 1535 |
``` cpp
|
| 1536 |
allocator_type get_allocator() const noexcept;
|
| 1537 |
```
|
| 1538 |
|
| 1539 |
-
*Returns:* `frames_.get_allocator()`.
|
| 1540 |
|
| 1541 |
``` cpp
|
| 1542 |
const_iterator begin() const noexcept;
|
| 1543 |
const_iterator cbegin() const noexcept;
|
| 1544 |
```
|
| 1545 |
|
| 1546 |
-
*Returns:* An iterator referring to the first element in
|
| 1547 |
`empty()` is `true`, then it returns the same value as `end()`.
|
| 1548 |
|
| 1549 |
``` cpp
|
| 1550 |
const_iterator end() const noexcept;
|
| 1551 |
const_iterator cend() const noexcept;
|
|
@@ -1566,42 +1589,42 @@ const_reverse_iterator crend() const noexcept;
|
|
| 1566 |
```
|
| 1567 |
|
| 1568 |
*Returns:* `reverse_iterator(cbegin())`.
|
| 1569 |
|
| 1570 |
``` cpp
|
| 1571 |
-
|
| 1572 |
```
|
| 1573 |
|
| 1574 |
-
*Returns:* `frames_.empty()`.
|
| 1575 |
|
| 1576 |
``` cpp
|
| 1577 |
size_type size() const noexcept;
|
| 1578 |
```
|
| 1579 |
|
| 1580 |
-
*Returns:* `frames_.size()`.
|
| 1581 |
|
| 1582 |
``` cpp
|
| 1583 |
size_type max_size() const noexcept;
|
| 1584 |
```
|
| 1585 |
|
| 1586 |
-
*Returns:* `frames_.max_size()`.
|
| 1587 |
|
| 1588 |
``` cpp
|
| 1589 |
const_reference operator[](size_type frame_no) const;
|
| 1590 |
```
|
| 1591 |
|
| 1592 |
-
|
| 1593 |
|
| 1594 |
-
*Returns:* `frames_[frame_no]`.
|
| 1595 |
|
| 1596 |
*Throws:* Nothing.
|
| 1597 |
|
| 1598 |
``` cpp
|
| 1599 |
const_reference at(size_type frame_no) const;
|
| 1600 |
```
|
| 1601 |
|
| 1602 |
-
*Returns:* `frames_[frame_no]`.
|
| 1603 |
|
| 1604 |
*Throws:* `out_of_range` if `frame_no >= size()`.
|
| 1605 |
|
| 1606 |
#### Comparisons <a id="stacktrace.basic.cmp">[[stacktrace.basic.cmp]]</a>
|
| 1607 |
|
|
@@ -1673,11 +1696,11 @@ template<class Allocator>
|
|
| 1673 |
ostream& operator<<(ostream& os, const basic_stacktrace<Allocator>& st);
|
| 1674 |
```
|
| 1675 |
|
| 1676 |
*Effects:* Equivalent to: `return os << to_string(st);`
|
| 1677 |
|
| 1678 |
-
###
|
| 1679 |
|
| 1680 |
``` cpp
|
| 1681 |
template<> struct formatter<stacktrace_entry>;
|
| 1682 |
```
|
| 1683 |
|
|
@@ -1705,19 +1728,88 @@ template<class Allocator> struct formatter<basic_stacktrace<Allocator>>;
|
|
| 1705 |
For `formatter<basic_stacktrace<Allocator>>`, *format-spec* is empty.
|
| 1706 |
|
| 1707 |
A `basic_stacktrace<Allocator>` object `s` is formatted as if by copying
|
| 1708 |
`to_string(s)` through the output iterator of the context.
|
| 1709 |
|
| 1710 |
-
###
|
| 1711 |
|
| 1712 |
``` cpp
|
| 1713 |
template<> struct hash<stacktrace_entry>;
|
| 1714 |
template<class Allocator> struct hash<basic_stacktrace<Allocator>>;
|
| 1715 |
```
|
| 1716 |
|
| 1717 |
The specializations are enabled [[unord.hash]].
|
| 1718 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1719 |
<!-- Link reference definitions -->
|
| 1720 |
[assertions]: #assertions
|
| 1721 |
[assertions.assert]: #assertions.assert
|
| 1722 |
[assertions.general]: #assertions.general
|
| 1723 |
[bad.alloc]: support.md#bad.alloc
|
|
@@ -1728,18 +1820,22 @@ The specializations are enabled [[unord.hash]].
|
|
| 1728 |
[concepts.object]: concepts.md#concepts.object
|
| 1729 |
[container.alloc.reqmts]: containers.md#container.alloc.reqmts
|
| 1730 |
[container.rev.reqmts]: containers.md#container.rev.reqmts
|
| 1731 |
[conv]: expr.md#conv
|
| 1732 |
[cpp.predefined]: cpp.md#cpp.predefined
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1733 |
[defns.const.subexpr]: intro.md#defns.const.subexpr
|
| 1734 |
[diagnostics]: #diagnostics
|
| 1735 |
[diagnostics.general]: #diagnostics.general
|
| 1736 |
[diagnostics.summary]: #diagnostics.summary
|
| 1737 |
[domain.error]: #domain.error
|
| 1738 |
[errno]: #errno
|
| 1739 |
[errno.general]: #errno.general
|
| 1740 |
-
[format.string.std]:
|
| 1741 |
[intro.execution]: basic.md#intro.execution
|
| 1742 |
[invalid.argument]: #invalid.argument
|
| 1743 |
[iterator.concept.random.access]: iterators.md#iterator.concept.random.access
|
| 1744 |
[length.error]: #length.error
|
| 1745 |
[logic.error]: #logic.error
|
|
@@ -1795,7 +1891,8 @@ The specializations are enabled [[unord.hash]].
|
|
| 1795 |
[syserr.hash]: #syserr.hash
|
| 1796 |
[syserr.syserr]: #syserr.syserr
|
| 1797 |
[syserr.syserr.members]: #syserr.syserr.members
|
| 1798 |
[syserr.syserr.overview]: #syserr.syserr.overview
|
| 1799 |
[system.error.syn]: #system.error.syn
|
|
|
|
| 1800 |
[underflow.error]: #underflow.error
|
| 1801 |
[unord.hash]: utilities.md#unord.hash
|
|
|
|
| 17 |
| [[std.exceptions]] | Exception classes | `<stdexcept>` |
|
| 18 |
| [[assertions]] | Assertions | `<cassert>` |
|
| 19 |
| [[errno]] | Error numbers | `<cerrno>` |
|
| 20 |
| [[syserr]] | System error support | `<system_error>` |
|
| 21 |
| [[stacktrace]] | Stacktrace | `<stacktrace>` |
|
| 22 |
+
| [[debugging]] | Debugging | `<debugging>` |
|
| 23 |
|
| 24 |
|
| 25 |
## Exception classes <a id="std.exceptions">[[std.exceptions]]</a>
|
| 26 |
|
| 27 |
### General <a id="std.exceptions.general">[[std.exceptions.general]]</a>
|
|
|
|
| 61 |
|
| 62 |
``` cpp
|
| 63 |
namespace std {
|
| 64 |
class logic_error : public exception {
|
| 65 |
public:
|
| 66 |
+
constexpr explicit logic_error(const string& what_arg);
|
| 67 |
+
constexpr explicit logic_error(const char* what_arg);
|
| 68 |
};
|
| 69 |
}
|
| 70 |
```
|
| 71 |
|
| 72 |
The class `logic_error` defines the type of objects thrown as exceptions
|
| 73 |
to report errors presumably detectable before the program executes, such
|
| 74 |
as violations of logical preconditions or class invariants.
|
| 75 |
|
| 76 |
``` cpp
|
| 77 |
+
constexpr logic_error(const string& what_arg);
|
| 78 |
```
|
| 79 |
|
| 80 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 81 |
|
| 82 |
``` cpp
|
| 83 |
+
constexpr logic_error(const char* what_arg);
|
| 84 |
```
|
| 85 |
|
| 86 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 87 |
|
| 88 |
### Class `domain_error` <a id="domain.error">[[domain.error]]</a>
|
| 89 |
|
| 90 |
``` cpp
|
| 91 |
namespace std {
|
| 92 |
class domain_error : public logic_error {
|
| 93 |
public:
|
| 94 |
+
constexpr explicit domain_error(const string& what_arg);
|
| 95 |
+
constexpr explicit domain_error(const char* what_arg);
|
| 96 |
};
|
| 97 |
}
|
| 98 |
```
|
| 99 |
|
| 100 |
The class `domain_error` defines the type of objects thrown as
|
| 101 |
exceptions by the implementation to report domain errors.
|
| 102 |
|
| 103 |
``` cpp
|
| 104 |
+
constexpr domain_error(const string& what_arg);
|
| 105 |
```
|
| 106 |
|
| 107 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 108 |
|
| 109 |
``` cpp
|
| 110 |
+
constexpr domain_error(const char* what_arg);
|
| 111 |
```
|
| 112 |
|
| 113 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 114 |
|
| 115 |
### Class `invalid_argument` <a id="invalid.argument">[[invalid.argument]]</a>
|
| 116 |
|
| 117 |
``` cpp
|
| 118 |
namespace std {
|
| 119 |
class invalid_argument : public logic_error {
|
| 120 |
public:
|
| 121 |
+
constexpr explicit invalid_argument(const string& what_arg);
|
| 122 |
+
constexpr explicit invalid_argument(const char* what_arg);
|
| 123 |
};
|
| 124 |
}
|
| 125 |
```
|
| 126 |
|
| 127 |
The class `invalid_argument` defines the type of objects thrown as
|
| 128 |
exceptions to report an invalid argument.
|
| 129 |
|
| 130 |
``` cpp
|
| 131 |
+
constexpr invalid_argument(const string& what_arg);
|
| 132 |
```
|
| 133 |
|
| 134 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 135 |
|
| 136 |
``` cpp
|
| 137 |
+
constexpr invalid_argument(const char* what_arg);
|
| 138 |
```
|
| 139 |
|
| 140 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 141 |
|
| 142 |
### Class `length_error` <a id="length.error">[[length.error]]</a>
|
| 143 |
|
| 144 |
``` cpp
|
| 145 |
namespace std {
|
| 146 |
class length_error : public logic_error {
|
| 147 |
public:
|
| 148 |
+
constexpr explicit length_error(const string& what_arg);
|
| 149 |
+
constexpr explicit length_error(const char* what_arg);
|
| 150 |
};
|
| 151 |
}
|
| 152 |
```
|
| 153 |
|
| 154 |
The class `length_error` defines the type of objects thrown as
|
| 155 |
exceptions to report an attempt to produce an object whose length
|
| 156 |
exceeds its maximum allowable size.
|
| 157 |
|
| 158 |
``` cpp
|
| 159 |
+
constexpr length_error(const string& what_arg);
|
| 160 |
```
|
| 161 |
|
| 162 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 163 |
|
| 164 |
``` cpp
|
| 165 |
+
constexpr length_error(const char* what_arg);
|
| 166 |
```
|
| 167 |
|
| 168 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 169 |
|
| 170 |
### Class `out_of_range` <a id="out.of.range">[[out.of.range]]</a>
|
| 171 |
|
| 172 |
``` cpp
|
| 173 |
namespace std {
|
| 174 |
class out_of_range : public logic_error {
|
| 175 |
public:
|
| 176 |
+
constexpr explicit out_of_range(const string& what_arg);
|
| 177 |
+
constexpr explicit out_of_range(const char* what_arg);
|
| 178 |
};
|
| 179 |
}
|
| 180 |
```
|
| 181 |
|
| 182 |
The class `out_of_range` defines the type of objects thrown as
|
| 183 |
exceptions to report an argument value not in its expected range.
|
| 184 |
|
| 185 |
``` cpp
|
| 186 |
+
constexpr out_of_range(const string& what_arg);
|
| 187 |
```
|
| 188 |
|
| 189 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 190 |
|
| 191 |
``` cpp
|
| 192 |
+
constexpr out_of_range(const char* what_arg);
|
| 193 |
```
|
| 194 |
|
| 195 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 196 |
|
| 197 |
### Class `runtime_error` <a id="runtime.error">[[runtime.error]]</a>
|
| 198 |
|
| 199 |
``` cpp
|
| 200 |
namespace std {
|
| 201 |
class runtime_error : public exception {
|
| 202 |
public:
|
| 203 |
+
constexpr explicit runtime_error(const string& what_arg);
|
| 204 |
+
constexpr explicit runtime_error(const char* what_arg);
|
| 205 |
};
|
| 206 |
}
|
| 207 |
```
|
| 208 |
|
| 209 |
The class `runtime_error` defines the type of objects thrown as
|
| 210 |
exceptions to report errors presumably detectable only when the program
|
| 211 |
executes.
|
| 212 |
|
| 213 |
``` cpp
|
| 214 |
+
constexpr runtime_error(const string& what_arg);
|
| 215 |
```
|
| 216 |
|
| 217 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 218 |
|
| 219 |
``` cpp
|
| 220 |
+
constexpr runtime_error(const char* what_arg);
|
| 221 |
```
|
| 222 |
|
| 223 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 224 |
|
| 225 |
### Class `range_error` <a id="range.error">[[range.error]]</a>
|
| 226 |
|
| 227 |
``` cpp
|
| 228 |
namespace std {
|
| 229 |
class range_error : public runtime_error {
|
| 230 |
public:
|
| 231 |
+
constexpr explicit range_error(const string& what_arg);
|
| 232 |
+
constexpr explicit range_error(const char* what_arg);
|
| 233 |
};
|
| 234 |
}
|
| 235 |
```
|
| 236 |
|
| 237 |
The class `range_error` defines the type of objects thrown as exceptions
|
| 238 |
to report range errors in internal computations.
|
| 239 |
|
| 240 |
``` cpp
|
| 241 |
+
constexpr range_error(const string& what_arg);
|
| 242 |
```
|
| 243 |
|
| 244 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 245 |
|
| 246 |
``` cpp
|
| 247 |
+
constexpr range_error(const char* what_arg);
|
| 248 |
```
|
| 249 |
|
| 250 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 251 |
|
| 252 |
### Class `overflow_error` <a id="overflow.error">[[overflow.error]]</a>
|
| 253 |
|
| 254 |
``` cpp
|
| 255 |
namespace std {
|
| 256 |
class overflow_error : public runtime_error {
|
| 257 |
public:
|
| 258 |
+
constexpr explicit overflow_error(const string& what_arg);
|
| 259 |
+
constexpr explicit overflow_error(const char* what_arg);
|
| 260 |
};
|
| 261 |
}
|
| 262 |
```
|
| 263 |
|
| 264 |
The class `overflow_error` defines the type of objects thrown as
|
| 265 |
exceptions to report an arithmetic overflow error.
|
| 266 |
|
| 267 |
``` cpp
|
| 268 |
+
constexpr overflow_error(const string& what_arg);
|
| 269 |
```
|
| 270 |
|
| 271 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 272 |
|
| 273 |
``` cpp
|
| 274 |
+
constexpr overflow_error(const char* what_arg);
|
| 275 |
```
|
| 276 |
|
| 277 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 278 |
|
| 279 |
### Class `underflow_error` <a id="underflow.error">[[underflow.error]]</a>
|
| 280 |
|
| 281 |
``` cpp
|
| 282 |
namespace std {
|
| 283 |
class underflow_error : public runtime_error {
|
| 284 |
public:
|
| 285 |
+
constexpr explicit underflow_error(const string& what_arg);
|
| 286 |
+
constexpr explicit underflow_error(const char* what_arg);
|
| 287 |
};
|
| 288 |
}
|
| 289 |
```
|
| 290 |
|
| 291 |
The class `underflow_error` defines the type of objects thrown as
|
| 292 |
exceptions to report an arithmetic underflow error.
|
| 293 |
|
| 294 |
``` cpp
|
| 295 |
+
constexpr underflow_error(const string& what_arg);
|
| 296 |
```
|
| 297 |
|
| 298 |
*Ensures:* `strcmp(what(), what_arg.c_str()) == 0`.
|
| 299 |
|
| 300 |
``` cpp
|
| 301 |
+
constexpr underflow_error(const char* what_arg);
|
| 302 |
```
|
| 303 |
|
| 304 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 305 |
|
| 306 |
## Assertions <a id="assertions">[[assertions]]</a>
|
| 307 |
|
| 308 |
### General <a id="assertions.general">[[assertions.general]]</a>
|
| 309 |
|
| 310 |
The header `<cassert>` provides a macro for documenting C++ program
|
| 311 |
+
assertions and a mechanism for disabling the assertion checks through
|
| 312 |
+
defining the macro `NDEBUG`.
|
| 313 |
|
| 314 |
### Header `<cassert>` synopsis <a id="cassert.syn">[[cassert.syn]]</a>
|
| 315 |
|
| 316 |
``` cpp
|
| 317 |
+
#define assert(...) see below
|
| 318 |
```
|
| 319 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
### The `assert` macro <a id="assertions.assert">[[assertions.assert]]</a>
|
| 321 |
|
| 322 |
+
If `NDEBUG` is defined as a macro name at the point in the source file
|
| 323 |
+
where `<cassert>` is included, the `assert` macro is defined as
|
| 324 |
+
|
| 325 |
+
``` cpp
|
| 326 |
+
#define assert(...) ((void)0)
|
| 327 |
+
```
|
| 328 |
+
|
| 329 |
+
Otherwise, the `assert` macro puts a diagnostic test into programs; it
|
| 330 |
+
expands to an expression of type `void` which has the following effects:
|
| 331 |
+
|
| 332 |
+
- `__VA_ARGS__` is evaluated and contextually converted to `bool`.
|
| 333 |
+
- If the evaluation yields `true` there are no further effects.
|
| 334 |
+
- Otherwise, the `assert` macro’s expression creates a diagnostic on the
|
| 335 |
+
standard error stream (ISO/IEC 9899:2018 (C), 7.23.3) in an
|
| 336 |
+
*implementation-defined* format and calls `abort()`. The diagnostic
|
| 337 |
+
contains `#``__VA_ARGS__` and information on the name of the source
|
| 338 |
+
file, the source line number, and the name of the enclosing function
|
| 339 |
+
(such as provided by `source_location::current()`).
|
| 340 |
+
|
| 341 |
+
If `__VA_ARGS__` does not expand to an *assignment-expression*, the
|
| 342 |
+
program is ill-formed.
|
| 343 |
+
|
| 344 |
+
The macro `assert` is redefined according to the current state of
|
| 345 |
+
`NDEBUG` each time that `<cassert>` is included.
|
| 346 |
+
|
| 347 |
An expression `assert(E)` is a constant subexpression
|
| 348 |
[[defns.const.subexpr]], if
|
| 349 |
|
| 350 |
- `NDEBUG` is defined at the point where `assert` is last defined or
|
| 351 |
redefined, or
|
|
|
|
| 367 |
### Header `<cerrno>` synopsis <a id="cerrno.syn">[[cerrno.syn]]</a>
|
| 368 |
|
| 369 |
``` cpp
|
| 370 |
#define errno see below
|
| 371 |
|
| 372 |
+
#define E2BIG see below // freestanding
|
| 373 |
+
#define EACCES see below // freestanding
|
| 374 |
+
#define EADDRINUSE see below // freestanding
|
| 375 |
+
#define EADDRNOTAVAIL see below // freestanding
|
| 376 |
+
#define EAFNOSUPPORT see below // freestanding
|
| 377 |
+
#define EAGAIN see below // freestanding
|
| 378 |
+
#define EALREADY see below // freestanding
|
| 379 |
+
#define EBADF see below // freestanding
|
| 380 |
+
#define EBADMSG see below // freestanding
|
| 381 |
+
#define EBUSY see below // freestanding
|
| 382 |
+
#define ECANCELED see below // freestanding
|
| 383 |
+
#define ECHILD see below // freestanding
|
| 384 |
+
#define ECONNABORTED see below // freestanding
|
| 385 |
+
#define ECONNREFUSED see below // freestanding
|
| 386 |
+
#define ECONNRESET see below // freestanding
|
| 387 |
+
#define EDEADLK see below // freestanding
|
| 388 |
+
#define EDESTADDRREQ see below // freestanding
|
| 389 |
+
#define EDOM see below // freestanding
|
| 390 |
+
#define EEXIST see below // freestanding
|
| 391 |
+
#define EFAULT see below // freestanding
|
| 392 |
+
#define EFBIG see below // freestanding
|
| 393 |
+
#define EHOSTUNREACH see below // freestanding
|
| 394 |
+
#define EIDRM see below // freestanding
|
| 395 |
+
#define EILSEQ see below // freestanding
|
| 396 |
+
#define EINPROGRESS see below // freestanding
|
| 397 |
+
#define EINTR see below // freestanding
|
| 398 |
+
#define EINVAL see below // freestanding
|
| 399 |
+
#define EIO see below // freestanding
|
| 400 |
+
#define EISCONN see below // freestanding
|
| 401 |
+
#define EISDIR see below // freestanding
|
| 402 |
+
#define ELOOP see below // freestanding
|
| 403 |
+
#define EMFILE see below // freestanding
|
| 404 |
+
#define EMLINK see below // freestanding
|
| 405 |
+
#define EMSGSIZE see below // freestanding
|
| 406 |
+
#define ENAMETOOLONG see below // freestanding
|
| 407 |
+
#define ENETDOWN see below // freestanding
|
| 408 |
+
#define ENETRESET see below // freestanding
|
| 409 |
+
#define ENETUNREACH see below // freestanding
|
| 410 |
+
#define ENFILE see below // freestanding
|
| 411 |
+
#define ENOBUFS see below // freestanding
|
| 412 |
+
#define ENODEV see below // freestanding
|
| 413 |
+
#define ENOENT see below // freestanding
|
| 414 |
+
#define ENOEXEC see below // freestanding
|
| 415 |
+
#define ENOLCK see below // freestanding
|
| 416 |
+
#define ENOLINK see below // freestanding
|
| 417 |
+
#define ENOMEM see below // freestanding
|
| 418 |
+
#define ENOMSG see below // freestanding
|
| 419 |
+
#define ENOPROTOOPT see below // freestanding
|
| 420 |
+
#define ENOSPC see below // freestanding
|
| 421 |
+
#define ENOSYS see below // freestanding
|
| 422 |
+
#define ENOTCONN see below // freestanding
|
| 423 |
+
#define ENOTDIR see below // freestanding
|
| 424 |
+
#define ENOTEMPTY see below // freestanding
|
| 425 |
+
#define ENOTRECOVERABLE see below // freestanding
|
| 426 |
+
#define ENOTSOCK see below // freestanding
|
| 427 |
+
#define ENOTSUP see below // freestanding
|
| 428 |
+
#define ENOTTY see below // freestanding
|
| 429 |
+
#define ENXIO see below // freestanding
|
| 430 |
+
#define EOPNOTSUPP see below // freestanding
|
| 431 |
+
#define EOVERFLOW see below // freestanding
|
| 432 |
+
#define EOWNERDEAD see below // freestanding
|
| 433 |
+
#define EPERM see below // freestanding
|
| 434 |
+
#define EPIPE see below // freestanding
|
| 435 |
+
#define EPROTO see below // freestanding
|
| 436 |
+
#define EPROTONOSUPPORT see below // freestanding
|
| 437 |
+
#define EPROTOTYPE see below // freestanding
|
| 438 |
+
#define ERANGE see below // freestanding
|
| 439 |
+
#define EROFS see below // freestanding
|
| 440 |
+
#define ESPIPE see below // freestanding
|
| 441 |
+
#define ESRCH see below // freestanding
|
| 442 |
+
#define ETIMEDOUT see below // freestanding
|
| 443 |
+
#define ETXTBSY see below // freestanding
|
| 444 |
+
#define EWOULDBLOCK see below // freestanding
|
| 445 |
+
#define EXDEV see below // freestanding
|
| 446 |
```
|
| 447 |
|
| 448 |
The meaning of the macros in this header is defined by the POSIX
|
| 449 |
standard.
|
| 450 |
|
|
|
|
| 482 |
struct is_error_code_enum : public false_type {};
|
| 483 |
|
| 484 |
template<class T>
|
| 485 |
struct is_error_condition_enum : public false_type {};
|
| 486 |
|
| 487 |
+
enum class errc { // freestanding
|
| 488 |
address_family_not_supported, // EAFNOSUPPORT
|
| 489 |
address_in_use, // EADDRINUSE
|
| 490 |
address_not_available, // EADDRNOTAVAIL
|
| 491 |
already_connected, // EISCONN
|
| 492 |
argument_list_too_long, // E2BIG
|
|
|
|
| 811 |
|
| 812 |
``` cpp
|
| 813 |
error_code() noexcept;
|
| 814 |
```
|
| 815 |
|
| 816 |
+
*Effects:* Initializes *val\_* with `0` and *cat\_* with
|
| 817 |
`&system_category()`.
|
| 818 |
|
| 819 |
``` cpp
|
| 820 |
error_code(int val, const error_category& cat) noexcept;
|
| 821 |
```
|
| 822 |
|
| 823 |
+
*Effects:* Initializes *val\_* with `val` and *cat\_* with `&cat`.
|
| 824 |
|
| 825 |
``` cpp
|
| 826 |
template<class ErrorCodeEnum>
|
| 827 |
error_code(ErrorCodeEnum e) noexcept;
|
| 828 |
```
|
|
|
|
| 840 |
|
| 841 |
``` cpp
|
| 842 |
void assign(int val, const error_category& cat) noexcept;
|
| 843 |
```
|
| 844 |
|
| 845 |
+
*Ensures:* *`val_`*` == val` and *`cat_`*` == &cat`.
|
| 846 |
|
| 847 |
``` cpp
|
| 848 |
template<class ErrorCodeEnum>
|
| 849 |
error_code& operator=(ErrorCodeEnum e) noexcept;
|
| 850 |
```
|
|
|
|
| 870 |
|
| 871 |
``` cpp
|
| 872 |
int value() const noexcept;
|
| 873 |
```
|
| 874 |
|
| 875 |
+
*Returns:* *val\_*.
|
| 876 |
|
| 877 |
``` cpp
|
| 878 |
const error_category& category() const noexcept;
|
| 879 |
```
|
| 880 |
|
| 881 |
+
*Returns:* `*`*`cat_`*.
|
| 882 |
|
| 883 |
``` cpp
|
| 884 |
error_condition default_error_condition() const noexcept;
|
| 885 |
```
|
| 886 |
|
|
|
|
| 958 |
|
| 959 |
``` cpp
|
| 960 |
error_condition() noexcept;
|
| 961 |
```
|
| 962 |
|
| 963 |
+
*Effects:* Initializes *val\_* with `0` and *cat\_* with
|
| 964 |
`&generic_category()`.
|
| 965 |
|
| 966 |
``` cpp
|
| 967 |
error_condition(int val, const error_category& cat) noexcept;
|
| 968 |
```
|
| 969 |
|
| 970 |
+
*Effects:* Initializes *val\_* with `val` and *cat\_* with `&cat`.
|
| 971 |
|
| 972 |
``` cpp
|
| 973 |
template<class ErrorConditionEnum>
|
| 974 |
error_condition(ErrorConditionEnum e) noexcept;
|
| 975 |
```
|
|
|
|
| 988 |
|
| 989 |
``` cpp
|
| 990 |
void assign(int val, const error_category& cat) noexcept;
|
| 991 |
```
|
| 992 |
|
| 993 |
+
*Ensures:* *`val_`*` == val` and *`cat_`*` == &cat`.
|
| 994 |
|
| 995 |
``` cpp
|
| 996 |
template<class ErrorConditionEnum>
|
| 997 |
error_condition& operator=(ErrorConditionEnum e) noexcept;
|
| 998 |
```
|
|
|
|
| 1019 |
|
| 1020 |
``` cpp
|
| 1021 |
int value() const noexcept;
|
| 1022 |
```
|
| 1023 |
|
| 1024 |
+
*Returns:* *val\_*.
|
| 1025 |
|
| 1026 |
``` cpp
|
| 1027 |
const error_category& category() const noexcept;
|
| 1028 |
```
|
| 1029 |
|
| 1030 |
+
*Returns:* `*`*`cat_`*.
|
| 1031 |
|
| 1032 |
``` cpp
|
| 1033 |
string message() const;
|
| 1034 |
```
|
| 1035 |
|
|
|
|
| 1433 |
const_iterator cbegin() const noexcept;
|
| 1434 |
const_iterator cend() const noexcept;
|
| 1435 |
const_reverse_iterator crbegin() const noexcept;
|
| 1436 |
const_reverse_iterator crend() const noexcept;
|
| 1437 |
|
| 1438 |
+
bool empty() const noexcept;
|
| 1439 |
size_type size() const noexcept;
|
| 1440 |
size_type max_size() const noexcept;
|
| 1441 |
|
| 1442 |
const_reference operator[](size_type) const;
|
| 1443 |
const_reference at(size_type) const;
|
|
|
|
| 1475 |
|
| 1476 |
``` cpp
|
| 1477 |
static basic_stacktrace current(const allocator_type& alloc = allocator_type()) noexcept;
|
| 1478 |
```
|
| 1479 |
|
| 1480 |
+
*Returns:* A `basic_stacktrace` object with *frames\_* storing the
|
| 1481 |
stacktrace of the current evaluation in the current thread of execution,
|
| 1482 |
+
or an empty `basic_stacktrace` object if the initialization of
|
| 1483 |
+
*frames\_* failed. `alloc` is passed to the constructor of the
|
| 1484 |
+
*frames\_* object.
|
| 1485 |
|
| 1486 |
[*Note 1*: If the stacktrace was successfully obtained, then
|
| 1487 |
+
*`frames_`*`.front()` is the `stacktrace_entry` representing
|
| 1488 |
+
approximately the current evaluation, and *`frames_`*`.back()` is the
|
| 1489 |
+
`stacktrace_entry` representing approximately the initial function of
|
| 1490 |
+
the current thread of execution. — *end note*]
|
| 1491 |
|
| 1492 |
``` cpp
|
| 1493 |
static basic_stacktrace current(size_type skip,
|
| 1494 |
const allocator_type& alloc = allocator_type()) noexcept;
|
| 1495 |
```
|
| 1496 |
|
| 1497 |
Let `t` be a stacktrace as-if obtained via
|
| 1498 |
`basic_stacktrace::current(alloc)`. Let `n` be `t.size()`.
|
| 1499 |
|
| 1500 |
+
*Returns:* A `basic_stacktrace` object where *frames\_* is
|
| 1501 |
direct-non-list-initialized from arguments `t.begin() + min(n, skip)`,
|
| 1502 |
`t.end()`, and `alloc`, or an empty `basic_stacktrace` object if the
|
| 1503 |
+
initialization of *frames\_* failed.
|
| 1504 |
|
| 1505 |
``` cpp
|
| 1506 |
static basic_stacktrace current(size_type skip, size_type max_depth,
|
| 1507 |
const allocator_type& alloc = allocator_type()) noexcept;
|
| 1508 |
```
|
| 1509 |
|
| 1510 |
Let `t` be a stacktrace as-if obtained via
|
| 1511 |
`basic_stacktrace::current(alloc)`. Let `n` be `t.size()`.
|
| 1512 |
|
| 1513 |
+
`skip <= skip + max_depth` is `true`.
|
| 1514 |
|
| 1515 |
+
*Returns:* A `basic_stacktrace` object where *frames\_* is
|
| 1516 |
direct-non-list-initialized from arguments `t.begin() + min(n, skip)`,
|
| 1517 |
`t.begin() + min(n, skip + max_depth)`, and `alloc`, or an empty
|
| 1518 |
+
`basic_stacktrace` object if the initialization of *frames\_* failed.
|
| 1519 |
|
| 1520 |
``` cpp
|
| 1521 |
basic_stacktrace() noexcept(is_nothrow_default_constructible_v<allocator_type>);
|
| 1522 |
```
|
| 1523 |
|
|
|
|
| 1525 |
|
| 1526 |
``` cpp
|
| 1527 |
explicit basic_stacktrace(const allocator_type& alloc) noexcept;
|
| 1528 |
```
|
| 1529 |
|
| 1530 |
+
*Effects:* `alloc` is passed to the *frames\_* constructor.
|
| 1531 |
|
| 1532 |
*Ensures:* `empty()` is `true`.
|
| 1533 |
|
| 1534 |
``` cpp
|
| 1535 |
basic_stacktrace(const basic_stacktrace& other);
|
|
|
|
| 1557 |
|
| 1558 |
``` cpp
|
| 1559 |
allocator_type get_allocator() const noexcept;
|
| 1560 |
```
|
| 1561 |
|
| 1562 |
+
*Returns:* *`frames_`*`.get_allocator()`.
|
| 1563 |
|
| 1564 |
``` cpp
|
| 1565 |
const_iterator begin() const noexcept;
|
| 1566 |
const_iterator cbegin() const noexcept;
|
| 1567 |
```
|
| 1568 |
|
| 1569 |
+
*Returns:* An iterator referring to the first element in *frames\_*. If
|
| 1570 |
`empty()` is `true`, then it returns the same value as `end()`.
|
| 1571 |
|
| 1572 |
``` cpp
|
| 1573 |
const_iterator end() const noexcept;
|
| 1574 |
const_iterator cend() const noexcept;
|
|
|
|
| 1589 |
```
|
| 1590 |
|
| 1591 |
*Returns:* `reverse_iterator(cbegin())`.
|
| 1592 |
|
| 1593 |
``` cpp
|
| 1594 |
+
bool empty() const noexcept;
|
| 1595 |
```
|
| 1596 |
|
| 1597 |
+
*Returns:* *`frames_`*`.empty()`.
|
| 1598 |
|
| 1599 |
``` cpp
|
| 1600 |
size_type size() const noexcept;
|
| 1601 |
```
|
| 1602 |
|
| 1603 |
+
*Returns:* *`frames_`*`.size()`.
|
| 1604 |
|
| 1605 |
``` cpp
|
| 1606 |
size_type max_size() const noexcept;
|
| 1607 |
```
|
| 1608 |
|
| 1609 |
+
*Returns:* *`frames_`*`.max_size()`.
|
| 1610 |
|
| 1611 |
``` cpp
|
| 1612 |
const_reference operator[](size_type frame_no) const;
|
| 1613 |
```
|
| 1614 |
|
| 1615 |
+
`frame_no < size()` is `true`.
|
| 1616 |
|
| 1617 |
+
*Returns:* *`frames_`*`[frame_no]`.
|
| 1618 |
|
| 1619 |
*Throws:* Nothing.
|
| 1620 |
|
| 1621 |
``` cpp
|
| 1622 |
const_reference at(size_type frame_no) const;
|
| 1623 |
```
|
| 1624 |
|
| 1625 |
+
*Returns:* *`frames_`*`[frame_no]`.
|
| 1626 |
|
| 1627 |
*Throws:* `out_of_range` if `frame_no >= size()`.
|
| 1628 |
|
| 1629 |
#### Comparisons <a id="stacktrace.basic.cmp">[[stacktrace.basic.cmp]]</a>
|
| 1630 |
|
|
|
|
| 1696 |
ostream& operator<<(ostream& os, const basic_stacktrace<Allocator>& st);
|
| 1697 |
```
|
| 1698 |
|
| 1699 |
*Effects:* Equivalent to: `return os << to_string(st);`
|
| 1700 |
|
| 1701 |
+
### Formatting support <a id="stacktrace.format">[[stacktrace.format]]</a>
|
| 1702 |
|
| 1703 |
``` cpp
|
| 1704 |
template<> struct formatter<stacktrace_entry>;
|
| 1705 |
```
|
| 1706 |
|
|
|
|
| 1728 |
For `formatter<basic_stacktrace<Allocator>>`, *format-spec* is empty.
|
| 1729 |
|
| 1730 |
A `basic_stacktrace<Allocator>` object `s` is formatted as if by copying
|
| 1731 |
`to_string(s)` through the output iterator of the context.
|
| 1732 |
|
| 1733 |
+
### Hash support <a id="stacktrace.basic.hash">[[stacktrace.basic.hash]]</a>
|
| 1734 |
|
| 1735 |
``` cpp
|
| 1736 |
template<> struct hash<stacktrace_entry>;
|
| 1737 |
template<class Allocator> struct hash<basic_stacktrace<Allocator>>;
|
| 1738 |
```
|
| 1739 |
|
| 1740 |
The specializations are enabled [[unord.hash]].
|
| 1741 |
|
| 1742 |
+
## Debugging <a id="debugging">[[debugging]]</a>
|
| 1743 |
+
|
| 1744 |
+
### General <a id="debugging.general">[[debugging.general]]</a>
|
| 1745 |
+
|
| 1746 |
+
Subclause [[debugging]] describes functionality to introspect and
|
| 1747 |
+
interact with the execution of the program.
|
| 1748 |
+
|
| 1749 |
+
[*Note 1*: The facilities provided by the debugging functionality
|
| 1750 |
+
interact with a program that could be tracing the execution of a C++
|
| 1751 |
+
program, such as a debugger. — *end note*]
|
| 1752 |
+
|
| 1753 |
+
### Header `<debugging>` synopsis <a id="debugging.syn">[[debugging.syn]]</a>
|
| 1754 |
+
|
| 1755 |
+
``` cpp
|
| 1756 |
+
// all freestanding
|
| 1757 |
+
namespace std {
|
| 1758 |
+
// [debugging.utility], utility
|
| 1759 |
+
void breakpoint() noexcept;
|
| 1760 |
+
void breakpoint_if_debugging() noexcept;
|
| 1761 |
+
bool is_debugger_present() noexcept;
|
| 1762 |
+
}
|
| 1763 |
+
```
|
| 1764 |
+
|
| 1765 |
+
### Utility <a id="debugging.utility">[[debugging.utility]]</a>
|
| 1766 |
+
|
| 1767 |
+
``` cpp
|
| 1768 |
+
void breakpoint() noexcept;
|
| 1769 |
+
```
|
| 1770 |
+
|
| 1771 |
+
The semantics of this function are *implementation-defined*.
|
| 1772 |
+
|
| 1773 |
+
[*Note 1*: It is intended that, when invoked with a debugger present,
|
| 1774 |
+
the execution of the program temporarily halts and execution is handed
|
| 1775 |
+
to the debugger until the program is either terminated by the debugger
|
| 1776 |
+
or the debugger resumes execution of the program as if the function was
|
| 1777 |
+
not invoked. In particular, there is no intent for a call to this
|
| 1778 |
+
function to accomodate resumption of the program in a different manner.
|
| 1779 |
+
If there is no debugger present, execution of the program can end
|
| 1780 |
+
abnormally. — *end note*]
|
| 1781 |
+
|
| 1782 |
+
``` cpp
|
| 1783 |
+
void breakpoint_if_debugging() noexcept;
|
| 1784 |
+
```
|
| 1785 |
+
|
| 1786 |
+
*Effects:* Equivalent to:
|
| 1787 |
+
|
| 1788 |
+
``` cpp
|
| 1789 |
+
if (is_debugger_present()) breakpoint();
|
| 1790 |
+
```
|
| 1791 |
+
|
| 1792 |
+
``` cpp
|
| 1793 |
+
bool is_debugger_present() noexcept;
|
| 1794 |
+
```
|
| 1795 |
+
|
| 1796 |
+
*Required behavior:* This function has no preconditions.
|
| 1797 |
+
|
| 1798 |
+
*Default behavior:* *implementation-defined*.
|
| 1799 |
+
|
| 1800 |
+
[*Note 2*: It is intended that, using an immediate (uncached) query to
|
| 1801 |
+
determine if the program is being traced by a debugger, an
|
| 1802 |
+
implementation returns `true` only when tracing the execution of the
|
| 1803 |
+
program with a debugger. On Windows or equivalent systems, this can be
|
| 1804 |
+
achieved by calling the `::IsDebuggerPresent()` Win32 function. For
|
| 1805 |
+
systems compatible with ISO/IEC 23360:2021, this can be achieved by
|
| 1806 |
+
checking for a tracing process, with a best-effort determination that
|
| 1807 |
+
such a tracing process is a debugger. — *end note*]
|
| 1808 |
+
|
| 1809 |
+
*Remarks:* This function is replaceable [[term.replaceable.function]].
|
| 1810 |
+
|
| 1811 |
<!-- Link reference definitions -->
|
| 1812 |
[assertions]: #assertions
|
| 1813 |
[assertions.assert]: #assertions.assert
|
| 1814 |
[assertions.general]: #assertions.general
|
| 1815 |
[bad.alloc]: support.md#bad.alloc
|
|
|
|
| 1820 |
[concepts.object]: concepts.md#concepts.object
|
| 1821 |
[container.alloc.reqmts]: containers.md#container.alloc.reqmts
|
| 1822 |
[container.rev.reqmts]: containers.md#container.rev.reqmts
|
| 1823 |
[conv]: expr.md#conv
|
| 1824 |
[cpp.predefined]: cpp.md#cpp.predefined
|
| 1825 |
+
[debugging]: #debugging
|
| 1826 |
+
[debugging.general]: #debugging.general
|
| 1827 |
+
[debugging.syn]: #debugging.syn
|
| 1828 |
+
[debugging.utility]: #debugging.utility
|
| 1829 |
[defns.const.subexpr]: intro.md#defns.const.subexpr
|
| 1830 |
[diagnostics]: #diagnostics
|
| 1831 |
[diagnostics.general]: #diagnostics.general
|
| 1832 |
[diagnostics.summary]: #diagnostics.summary
|
| 1833 |
[domain.error]: #domain.error
|
| 1834 |
[errno]: #errno
|
| 1835 |
[errno.general]: #errno.general
|
| 1836 |
+
[format.string.std]: text.md#format.string.std
|
| 1837 |
[intro.execution]: basic.md#intro.execution
|
| 1838 |
[invalid.argument]: #invalid.argument
|
| 1839 |
[iterator.concept.random.access]: iterators.md#iterator.concept.random.access
|
| 1840 |
[length.error]: #length.error
|
| 1841 |
[logic.error]: #logic.error
|
|
|
|
| 1891 |
[syserr.hash]: #syserr.hash
|
| 1892 |
[syserr.syserr]: #syserr.syserr
|
| 1893 |
[syserr.syserr.members]: #syserr.syserr.members
|
| 1894 |
[syserr.syserr.overview]: #syserr.syserr.overview
|
| 1895 |
[system.error.syn]: #system.error.syn
|
| 1896 |
+
[term.replaceable.function]: dcl.md#term.replaceable.function
|
| 1897 |
[underflow.error]: #underflow.error
|
| 1898 |
[unord.hash]: utilities.md#unord.hash
|