- tmp/tmppgi93ym6/{from.md → to.md} +635 -42
tmp/tmppgi93ym6/{from.md → to.md}
RENAMED
|
@@ -4,26 +4,29 @@
|
|
| 4 |
|
| 5 |
This Clause describes components that C++ programs may use to detect and
|
| 6 |
report error conditions.
|
| 7 |
|
| 8 |
The following subclauses describe components for reporting several kinds
|
| 9 |
-
of exceptional conditions, documenting program assertions,
|
| 10 |
-
variable for error number codes, as summarized
|
| 11 |
-
[[diagnostics.summary]].
|
| 12 |
|
| 13 |
**Table: Diagnostics library summary** <a id="diagnostics.summary">[diagnostics.summary]</a>
|
| 14 |
|
| 15 |
| Subclause | | Header |
|
| 16 |
| ------------------ | -------------------- | ---------------- |
|
| 17 |
| [[std.exceptions]] | Exception classes | `<stdexcept>` |
|
| 18 |
| [[assertions]] | Assertions | `<cassert>` |
|
| 19 |
| [[errno]] | Error numbers | `<cerrno>` |
|
| 20 |
| [[syserr]] | System error support | `<system_error>` |
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
## Exception classes <a id="std.exceptions">[[std.exceptions]]</a>
|
| 24 |
|
|
|
|
|
|
|
| 25 |
The C++ standard library provides classes to be used to report certain
|
| 26 |
errors [[res.on.exception.handling]] in C++ programs. In the error model
|
| 27 |
reflected in these classes, errors are divided into two broad
|
| 28 |
categories: *logic* errors and *runtime* errors.
|
| 29 |
|
|
@@ -299,10 +302,12 @@ underflow_error(const char* what_arg);
|
|
| 299 |
|
| 300 |
*Ensures:* `strcmp(what(), what_arg) == 0`.
|
| 301 |
|
| 302 |
## Assertions <a id="assertions">[[assertions]]</a>
|
| 303 |
|
|
|
|
|
|
|
| 304 |
The header `<cassert>` provides a macro for documenting C++ program
|
| 305 |
assertions and a mechanism for disabling the assertion checks.
|
| 306 |
|
| 307 |
### Header `<cassert>` synopsis <a id="cassert.syn">[[cassert.syn]]</a>
|
| 308 |
|
|
@@ -325,17 +330,19 @@ An expression `assert(E)` is a constant subexpression
|
|
| 325 |
- `E` contextually converted to `bool` [[conv]] is a constant
|
| 326 |
subexpression that evaluates to the value `true`.
|
| 327 |
|
| 328 |
## Error numbers <a id="errno">[[errno]]</a>
|
| 329 |
|
|
|
|
|
|
|
| 330 |
The contents of the header `<cerrno>` are the same as the POSIX header
|
| 331 |
`<errno.h>`, except that `errno` shall be defined as a macro.
|
| 332 |
|
| 333 |
[*Note 1*: The intent is to remain in close alignment with the POSIX
|
| 334 |
standard. — *end note*]
|
| 335 |
|
| 336 |
-
A separate `errno` value
|
| 337 |
|
| 338 |
### Header `<cerrno>` synopsis <a id="cerrno.syn">[[cerrno.syn]]</a>
|
| 339 |
|
| 340 |
``` cpp
|
| 341 |
#define errno see below
|
|
@@ -378,22 +385,19 @@ A separate `errno` value shall be provided for each thread.
|
|
| 378 |
#define ENETDOWN see below
|
| 379 |
#define ENETRESET see below
|
| 380 |
#define ENETUNREACH see below
|
| 381 |
#define ENFILE see below
|
| 382 |
#define ENOBUFS see below
|
| 383 |
-
#define ENODATA see below
|
| 384 |
#define ENODEV see below
|
| 385 |
#define ENOENT see below
|
| 386 |
#define ENOEXEC see below
|
| 387 |
#define ENOLCK see below
|
| 388 |
#define ENOLINK see below
|
| 389 |
#define ENOMEM see below
|
| 390 |
#define ENOMSG see below
|
| 391 |
#define ENOPROTOOPT see below
|
| 392 |
#define ENOSPC see below
|
| 393 |
-
#define ENOSR see below
|
| 394 |
-
#define ENOSTR see below
|
| 395 |
#define ENOSYS see below
|
| 396 |
#define ENOTCONN see below
|
| 397 |
#define ENOTDIR see below
|
| 398 |
#define ENOTEMPTY see below
|
| 399 |
#define ENOTRECOVERABLE see below
|
|
@@ -411,11 +415,10 @@ A separate `errno` value shall be provided for each thread.
|
|
| 411 |
#define EPROTOTYPE see below
|
| 412 |
#define ERANGE see below
|
| 413 |
#define EROFS see below
|
| 414 |
#define ESPIPE see below
|
| 415 |
#define ESRCH see below
|
| 416 |
-
#define ETIME see below
|
| 417 |
#define ETIMEDOUT see below
|
| 418 |
#define ETXTBSY see below
|
| 419 |
#define EWOULDBLOCK see below
|
| 420 |
#define EXDEV see below
|
| 421 |
```
|
|
@@ -425,16 +428,20 @@ standard.
|
|
| 425 |
|
| 426 |
See also: ISO C 7.5
|
| 427 |
|
| 428 |
## System error support <a id="syserr">[[syserr]]</a>
|
| 429 |
|
| 430 |
-
|
| 431 |
-
|
|
|
|
|
|
|
| 432 |
operating system or other low-level application program interfaces.
|
| 433 |
|
| 434 |
-
Components described in
|
| 435 |
-
|
|
|
|
|
|
|
| 436 |
provided by other libraries unchanged.
|
| 437 |
|
| 438 |
### Header `<system_error>` synopsis <a id="system.error.syn">[[system.error.syn]]</a>
|
| 439 |
|
| 440 |
``` cpp
|
|
@@ -494,22 +501,19 @@ namespace std {
|
|
| 494 |
network_unreachable, // ENETUNREACH
|
| 495 |
no_buffer_space, // ENOBUFS
|
| 496 |
no_child_process, // ECHILD
|
| 497 |
no_link, // ENOLINK
|
| 498 |
no_lock_available, // ENOLCK
|
| 499 |
-
no_message_available, // ENODATA
|
| 500 |
no_message, // ENOMSG
|
| 501 |
no_protocol_option, // ENOPROTOOPT
|
| 502 |
no_space_on_device, // ENOSPC
|
| 503 |
-
no_stream_resources, // ENOSR
|
| 504 |
no_such_device_or_address, // ENXIO
|
| 505 |
no_such_device, // ENODEV
|
| 506 |
no_such_file_or_directory, // ENOENT
|
| 507 |
no_such_process, // ESRCH
|
| 508 |
not_a_directory, // ENOTDIR
|
| 509 |
not_a_socket, // ENOTSOCK
|
| 510 |
-
not_a_stream, // ENOSTR
|
| 511 |
not_connected, // ENOTCONN
|
| 512 |
not_enough_memory, // ENOMEM
|
| 513 |
not_supported, // ENOTSUP
|
| 514 |
operation_canceled, // ECANCELED
|
| 515 |
operation_in_progress, // EINPROGRESS
|
|
@@ -523,11 +527,10 @@ namespace std {
|
|
| 523 |
read_only_file_system, // EROFS
|
| 524 |
resource_deadlock_would_occur, // EDEADLK
|
| 525 |
resource_unavailable_try_again, // EAGAIN
|
| 526 |
result_out_of_range, // ERANGE
|
| 527 |
state_not_recoverable, // ENOTRECOVERABLE
|
| 528 |
-
stream_timeout, // ETIME
|
| 529 |
text_file_busy, // ETXTBSY
|
| 530 |
timed_out, // ETIMEDOUT
|
| 531 |
too_many_files_open_in_system, // ENFILE
|
| 532 |
too_many_files_open, // EMFILE
|
| 533 |
too_many_links, // EMLINK
|
|
@@ -546,11 +549,11 @@ namespace std {
|
|
| 546 |
operator<<(basic_ostream<charT, traits>& os, const error_code& ec);
|
| 547 |
|
| 548 |
// [syserr.errcondition.nonmembers], non-member functions
|
| 549 |
error_condition make_error_condition(errc e) noexcept;
|
| 550 |
|
| 551 |
-
// [syserr.compare], comparison functions
|
| 552 |
bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
|
| 553 |
bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
|
| 554 |
bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
|
| 555 |
strong_ordering operator<=>(const error_code& lhs, const error_code& rhs) noexcept;
|
| 556 |
strong_ordering operator<=>(const error_condition& lhs, const error_condition& rhs) noexcept;
|
|
@@ -560,24 +563,24 @@ namespace std {
|
|
| 560 |
template<> struct hash<error_code>;
|
| 561 |
template<> struct hash<error_condition>;
|
| 562 |
|
| 563 |
// [syserr], system error support
|
| 564 |
template<class T>
|
| 565 |
-
|
| 566 |
template<class T>
|
| 567 |
-
|
| 568 |
}
|
| 569 |
```
|
| 570 |
|
| 571 |
-
The value of each `enum errc`
|
| 572 |
-
|
| 573 |
`<system_error>` implementation exposes the `<cerrno>` macros is
|
| 574 |
unspecified.
|
| 575 |
|
| 576 |
-
The `is_error_code_enum` and `is_error_condition_enum` may be
|
| 577 |
specialized for program-defined types to indicate that such types are
|
| 578 |
-
eligible for `class error_code` and `class error_condition`
|
| 579 |
conversions, respectively.
|
| 580 |
|
| 581 |
### Class `error_category` <a id="syserr.errcat">[[syserr.errcat]]</a>
|
| 582 |
|
| 583 |
#### Overview <a id="syserr.errcat.overview">[[syserr.errcat.overview]]</a>
|
|
@@ -587,13 +590,14 @@ identify the source and encoding of a particular category of error code.
|
|
| 587 |
Classes may be derived from `error_category` to support categories of
|
| 588 |
errors in addition to those defined in this document. Such classes shall
|
| 589 |
behave as specified in subclause [[syserr.errcat]].
|
| 590 |
|
| 591 |
[*Note 1*: `error_category` objects are passed by reference, and two
|
| 592 |
-
such objects are equal if they have the same address.
|
| 593 |
-
|
| 594 |
-
|
|
|
|
| 595 |
|
| 596 |
``` cpp
|
| 597 |
namespace std {
|
| 598 |
class error_category {
|
| 599 |
public:
|
|
@@ -719,19 +723,20 @@ the same object.
|
|
| 719 |
*Remarks:* The object’s `equivalent` virtual functions shall behave as
|
| 720 |
specified for class `error_category`. The object’s `name` virtual
|
| 721 |
function shall return a pointer to the string `"system"`. The object’s
|
| 722 |
`default_error_condition` virtual function shall behave as follows:
|
| 723 |
|
| 724 |
-
If the argument `ev`
|
| 725 |
-
|
| 726 |
-
|
| 727 |
-
`error_condition(
|
|
|
|
| 728 |
correspondence for any given operating system is unspecified.
|
| 729 |
|
| 730 |
[*Note 1*: The number of potential system error codes is large and
|
| 731 |
-
unbounded, and some
|
| 732 |
-
implementations are given latitude in determining
|
| 733 |
correspondence. — *end note*]
|
| 734 |
|
| 735 |
### Class `error_code` <a id="syserr.errcode">[[syserr.errcode]]</a>
|
| 736 |
|
| 737 |
#### Overview <a id="syserr.errcode.overview">[[syserr.errcode.overview]]</a>
|
|
@@ -784,26 +789,32 @@ namespace std {
|
|
| 784 |
|
| 785 |
``` cpp
|
| 786 |
error_code() noexcept;
|
| 787 |
```
|
| 788 |
|
| 789 |
-
*
|
|
|
|
| 790 |
|
| 791 |
``` cpp
|
| 792 |
error_code(int val, const error_category& cat) noexcept;
|
| 793 |
```
|
| 794 |
|
| 795 |
-
*
|
| 796 |
|
| 797 |
``` cpp
|
| 798 |
template<class ErrorCodeEnum>
|
| 799 |
error_code(ErrorCodeEnum e) noexcept;
|
| 800 |
```
|
| 801 |
|
| 802 |
*Constraints:* `is_error_code_enum_v<ErrorCodeEnum>` is `true`.
|
| 803 |
|
| 804 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 805 |
|
| 806 |
#### Modifiers <a id="syserr.errcode.modifiers">[[syserr.errcode.modifiers]]</a>
|
| 807 |
|
| 808 |
``` cpp
|
| 809 |
void assign(int val, const error_category& cat) noexcept;
|
|
@@ -816,11 +827,16 @@ template<class ErrorCodeEnum>
|
|
| 816 |
error_code& operator=(ErrorCodeEnum e) noexcept;
|
| 817 |
```
|
| 818 |
|
| 819 |
*Constraints:* `is_error_code_enum_v<ErrorCodeEnum>` is `true`.
|
| 820 |
|
| 821 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 822 |
|
| 823 |
*Returns:* `*this`.
|
| 824 |
|
| 825 |
``` cpp
|
| 826 |
void clear() noexcept;
|
|
@@ -920,27 +936,33 @@ namespace std {
|
|
| 920 |
|
| 921 |
``` cpp
|
| 922 |
error_condition() noexcept;
|
| 923 |
```
|
| 924 |
|
| 925 |
-
*
|
|
|
|
| 926 |
|
| 927 |
``` cpp
|
| 928 |
error_condition(int val, const error_category& cat) noexcept;
|
| 929 |
```
|
| 930 |
|
| 931 |
-
*
|
| 932 |
|
| 933 |
``` cpp
|
| 934 |
template<class ErrorConditionEnum>
|
| 935 |
error_condition(ErrorConditionEnum e) noexcept;
|
| 936 |
```
|
| 937 |
|
| 938 |
*Constraints:* `is_error_condition_enum_v<ErrorConditionEnum>` is
|
| 939 |
`true`.
|
| 940 |
|
| 941 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 942 |
|
| 943 |
#### Modifiers <a id="syserr.errcondition.modifiers">[[syserr.errcondition.modifiers]]</a>
|
| 944 |
|
| 945 |
``` cpp
|
| 946 |
void assign(int val, const error_category& cat) noexcept;
|
|
@@ -954,11 +976,16 @@ template<class ErrorConditionEnum>
|
|
| 954 |
```
|
| 955 |
|
| 956 |
*Constraints:* `is_error_condition_enum_v<ErrorConditionEnum>` is
|
| 957 |
`true`.
|
| 958 |
|
| 959 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 960 |
|
| 961 |
*Returns:* `*this`.
|
| 962 |
|
| 963 |
``` cpp
|
| 964 |
void clear() noexcept;
|
|
@@ -998,11 +1025,11 @@ explicit operator bool() const noexcept;
|
|
| 998 |
error_condition make_error_condition(errc e) noexcept;
|
| 999 |
```
|
| 1000 |
|
| 1001 |
*Returns:* `error_condition(static_cast<int>(e), generic_category())`.
|
| 1002 |
|
| 1003 |
-
### Comparison functions <a id="syserr.compare">[[syserr.compare]]</a>
|
| 1004 |
|
| 1005 |
``` cpp
|
| 1006 |
bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
|
| 1007 |
```
|
| 1008 |
|
|
@@ -1153,33 +1180,598 @@ const char* what() const noexcept override;
|
|
| 1153 |
constructor.
|
| 1154 |
|
| 1155 |
[*Note 1*: The returned NTBS might be the contents of
|
| 1156 |
`what_arg + ": " + code.message()`. — *end note*]
|
| 1157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1158 |
<!-- Link reference definitions -->
|
| 1159 |
[assertions]: #assertions
|
| 1160 |
[assertions.assert]: #assertions.assert
|
|
|
|
| 1161 |
[bad.alloc]: support.md#bad.alloc
|
| 1162 |
[cassert.syn]: #cassert.syn
|
| 1163 |
[cerrno.syn]: #cerrno.syn
|
|
|
|
| 1164 |
[comparisons.three.way]: utilities.md#comparisons.three.way
|
|
|
|
|
|
|
|
|
|
| 1165 |
[conv]: expr.md#conv
|
| 1166 |
-
[
|
|
|
|
| 1167 |
[diagnostics]: #diagnostics
|
| 1168 |
[diagnostics.general]: #diagnostics.general
|
| 1169 |
[diagnostics.summary]: #diagnostics.summary
|
| 1170 |
[domain.error]: #domain.error
|
| 1171 |
[errno]: #errno
|
|
|
|
|
|
|
|
|
|
| 1172 |
[invalid.argument]: #invalid.argument
|
|
|
|
| 1173 |
[length.error]: #length.error
|
| 1174 |
[logic.error]: #logic.error
|
| 1175 |
[out.of.range]: #out.of.range
|
| 1176 |
[overflow.error]: #overflow.error
|
|
|
|
| 1177 |
[range.error]: #range.error
|
| 1178 |
[res.on.exception.handling]: library.md#res.on.exception.handling
|
| 1179 |
[runtime.error]: #runtime.error
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1180 |
[std.exceptions]: #std.exceptions
|
|
|
|
| 1181 |
[stdexcept.syn]: #stdexcept.syn
|
| 1182 |
[syserr]: #syserr
|
| 1183 |
[syserr.compare]: #syserr.compare
|
| 1184 |
[syserr.errcat]: #syserr.errcat
|
| 1185 |
[syserr.errcat.derived]: #syserr.errcat.derived
|
|
@@ -1197,10 +1789,11 @@ constructor.
|
|
| 1197 |
[syserr.errcondition.constructors]: #syserr.errcondition.constructors
|
| 1198 |
[syserr.errcondition.modifiers]: #syserr.errcondition.modifiers
|
| 1199 |
[syserr.errcondition.nonmembers]: #syserr.errcondition.nonmembers
|
| 1200 |
[syserr.errcondition.observers]: #syserr.errcondition.observers
|
| 1201 |
[syserr.errcondition.overview]: #syserr.errcondition.overview
|
|
|
|
| 1202 |
[syserr.hash]: #syserr.hash
|
| 1203 |
[syserr.syserr]: #syserr.syserr
|
| 1204 |
[syserr.syserr.members]: #syserr.syserr.members
|
| 1205 |
[syserr.syserr.overview]: #syserr.syserr.overview
|
| 1206 |
[system.error.syn]: #system.error.syn
|
|
|
|
| 4 |
|
| 5 |
This Clause describes components that C++ programs may use to detect and
|
| 6 |
report error conditions.
|
| 7 |
|
| 8 |
The following subclauses describe components for reporting several kinds
|
| 9 |
+
of exceptional conditions, documenting program assertions, obtaining
|
| 10 |
+
stacktraces, and a global variable for error number codes, as summarized
|
| 11 |
+
in [[diagnostics.summary]].
|
| 12 |
|
| 13 |
**Table: Diagnostics library summary** <a id="diagnostics.summary">[diagnostics.summary]</a>
|
| 14 |
|
| 15 |
| Subclause | | Header |
|
| 16 |
| ------------------ | -------------------- | ---------------- |
|
| 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>
|
| 27 |
+
|
| 28 |
The C++ standard library provides classes to be used to report certain
|
| 29 |
errors [[res.on.exception.handling]] in C++ programs. In the error model
|
| 30 |
reflected in these classes, errors are divided into two broad
|
| 31 |
categories: *logic* errors and *runtime* errors.
|
| 32 |
|
|
|
|
| 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 |
|
|
|
|
| 330 |
- `E` contextually converted to `bool` [[conv]] is a constant
|
| 331 |
subexpression that evaluates to the value `true`.
|
| 332 |
|
| 333 |
## Error numbers <a id="errno">[[errno]]</a>
|
| 334 |
|
| 335 |
+
### General <a id="errno.general">[[errno.general]]</a>
|
| 336 |
+
|
| 337 |
The contents of the header `<cerrno>` are the same as the POSIX header
|
| 338 |
`<errno.h>`, except that `errno` shall be defined as a macro.
|
| 339 |
|
| 340 |
[*Note 1*: The intent is to remain in close alignment with the POSIX
|
| 341 |
standard. — *end note*]
|
| 342 |
|
| 343 |
+
A separate `errno` value is provided for each thread.
|
| 344 |
|
| 345 |
### Header `<cerrno>` synopsis <a id="cerrno.syn">[[cerrno.syn]]</a>
|
| 346 |
|
| 347 |
``` cpp
|
| 348 |
#define errno 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
|
|
|
|
| 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 |
```
|
|
|
|
| 428 |
|
| 429 |
See also: ISO C 7.5
|
| 430 |
|
| 431 |
## System error support <a id="syserr">[[syserr]]</a>
|
| 432 |
|
| 433 |
+
### General <a id="syserr.general">[[syserr.general]]</a>
|
| 434 |
+
|
| 435 |
+
Subclause [[syserr]] describes components that the standard library and
|
| 436 |
+
C++ programs may use to report error conditions originating from the
|
| 437 |
operating system or other low-level application program interfaces.
|
| 438 |
|
| 439 |
+
Components described in [[syserr]] do not change the value of `errno`
|
| 440 |
+
[[errno]].
|
| 441 |
+
|
| 442 |
+
*Recommended practice:* Implementations should leave the error states
|
| 443 |
provided by other libraries unchanged.
|
| 444 |
|
| 445 |
### Header `<system_error>` synopsis <a id="system.error.syn">[[system.error.syn]]</a>
|
| 446 |
|
| 447 |
``` cpp
|
|
|
|
| 501 |
network_unreachable, // ENETUNREACH
|
| 502 |
no_buffer_space, // ENOBUFS
|
| 503 |
no_child_process, // ECHILD
|
| 504 |
no_link, // ENOLINK
|
| 505 |
no_lock_available, // ENOLCK
|
|
|
|
| 506 |
no_message, // ENOMSG
|
| 507 |
no_protocol_option, // ENOPROTOOPT
|
| 508 |
no_space_on_device, // ENOSPC
|
|
|
|
| 509 |
no_such_device_or_address, // ENXIO
|
| 510 |
no_such_device, // ENODEV
|
| 511 |
no_such_file_or_directory, // ENOENT
|
| 512 |
no_such_process, // ESRCH
|
| 513 |
not_a_directory, // ENOTDIR
|
| 514 |
not_a_socket, // ENOTSOCK
|
|
|
|
| 515 |
not_connected, // ENOTCONN
|
| 516 |
not_enough_memory, // ENOMEM
|
| 517 |
not_supported, // ENOTSUP
|
| 518 |
operation_canceled, // ECANCELED
|
| 519 |
operation_in_progress, // EINPROGRESS
|
|
|
|
| 527 |
read_only_file_system, // EROFS
|
| 528 |
resource_deadlock_would_occur, // EDEADLK
|
| 529 |
resource_unavailable_try_again, // EAGAIN
|
| 530 |
result_out_of_range, // ERANGE
|
| 531 |
state_not_recoverable, // ENOTRECOVERABLE
|
|
|
|
| 532 |
text_file_busy, // ETXTBSY
|
| 533 |
timed_out, // ETIMEDOUT
|
| 534 |
too_many_files_open_in_system, // ENFILE
|
| 535 |
too_many_files_open, // EMFILE
|
| 536 |
too_many_links, // EMLINK
|
|
|
|
| 549 |
operator<<(basic_ostream<charT, traits>& os, const error_code& ec);
|
| 550 |
|
| 551 |
// [syserr.errcondition.nonmembers], non-member functions
|
| 552 |
error_condition make_error_condition(errc e) noexcept;
|
| 553 |
|
| 554 |
+
// [syserr.compare], comparison operator functions
|
| 555 |
bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
|
| 556 |
bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
|
| 557 |
bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
|
| 558 |
strong_ordering operator<=>(const error_code& lhs, const error_code& rhs) noexcept;
|
| 559 |
strong_ordering operator<=>(const error_condition& lhs, const error_condition& rhs) noexcept;
|
|
|
|
| 563 |
template<> struct hash<error_code>;
|
| 564 |
template<> struct hash<error_condition>;
|
| 565 |
|
| 566 |
// [syserr], system error support
|
| 567 |
template<class T>
|
| 568 |
+
constexpr bool is_error_code_enum_v = is_error_code_enum<T>::value;
|
| 569 |
template<class T>
|
| 570 |
+
constexpr bool is_error_condition_enum_v = is_error_condition_enum<T>::value;
|
| 571 |
}
|
| 572 |
```
|
| 573 |
|
| 574 |
+
The value of each `enum errc` enumerator is the same as the value of the
|
| 575 |
+
`<cerrno>` macro shown in the above synopsis. Whether or not the
|
| 576 |
`<system_error>` implementation exposes the `<cerrno>` macros is
|
| 577 |
unspecified.
|
| 578 |
|
| 579 |
+
The `is_error_code_enum` and `is_error_condition_enum` templates may be
|
| 580 |
specialized for program-defined types to indicate that such types are
|
| 581 |
+
eligible for `class error_code` and `class error_condition` implicit
|
| 582 |
conversions, respectively.
|
| 583 |
|
| 584 |
### Class `error_category` <a id="syserr.errcat">[[syserr.errcat]]</a>
|
| 585 |
|
| 586 |
#### Overview <a id="syserr.errcat.overview">[[syserr.errcat.overview]]</a>
|
|
|
|
| 590 |
Classes may be derived from `error_category` to support categories of
|
| 591 |
errors in addition to those defined in this document. Such classes shall
|
| 592 |
behave as specified in subclause [[syserr.errcat]].
|
| 593 |
|
| 594 |
[*Note 1*: `error_category` objects are passed by reference, and two
|
| 595 |
+
such objects are equal if they have the same address. If there is more
|
| 596 |
+
than a single object of a custom `error_category` type, such equality
|
| 597 |
+
comparisons can evaluate to `false` even for objects holding the same
|
| 598 |
+
value. — *end note*]
|
| 599 |
|
| 600 |
``` cpp
|
| 601 |
namespace std {
|
| 602 |
class error_category {
|
| 603 |
public:
|
|
|
|
| 723 |
*Remarks:* The object’s `equivalent` virtual functions shall behave as
|
| 724 |
specified for class `error_category`. The object’s `name` virtual
|
| 725 |
function shall return a pointer to the string `"system"`. The object’s
|
| 726 |
`default_error_condition` virtual function shall behave as follows:
|
| 727 |
|
| 728 |
+
If the argument `ev` is equal to 0, the function returns
|
| 729 |
+
`error_condition(0, generic_category())`. Otherwise, if `ev` corresponds
|
| 730 |
+
to a POSIX `errno` value `pxv`, the function returns
|
| 731 |
+
`error_condition(pxv, generic_category())`. Otherwise, the function
|
| 732 |
+
returns `error_condition(ev, system_category())`. What constitutes
|
| 733 |
correspondence for any given operating system is unspecified.
|
| 734 |
|
| 735 |
[*Note 1*: The number of potential system error codes is large and
|
| 736 |
+
unbounded, and some might not correspond to any POSIX `errno` value.
|
| 737 |
+
Thus implementations are given latitude in determining
|
| 738 |
correspondence. — *end note*]
|
| 739 |
|
| 740 |
### Class `error_code` <a id="syserr.errcode">[[syserr.errcode]]</a>
|
| 741 |
|
| 742 |
#### Overview <a id="syserr.errcode.overview">[[syserr.errcode.overview]]</a>
|
|
|
|
| 789 |
|
| 790 |
``` cpp
|
| 791 |
error_code() noexcept;
|
| 792 |
```
|
| 793 |
|
| 794 |
+
*Effects:* Initializes `val_` with `0` and `cat_` with
|
| 795 |
+
`&system_category()`.
|
| 796 |
|
| 797 |
``` cpp
|
| 798 |
error_code(int val, const error_category& cat) noexcept;
|
| 799 |
```
|
| 800 |
|
| 801 |
+
*Effects:* Initializes `val_` with `val` and `cat_` with `&cat`.
|
| 802 |
|
| 803 |
``` cpp
|
| 804 |
template<class ErrorCodeEnum>
|
| 805 |
error_code(ErrorCodeEnum e) noexcept;
|
| 806 |
```
|
| 807 |
|
| 808 |
*Constraints:* `is_error_code_enum_v<ErrorCodeEnum>` is `true`.
|
| 809 |
|
| 810 |
+
*Effects:* Equivalent to:
|
| 811 |
+
|
| 812 |
+
``` cpp
|
| 813 |
+
error_code ec = make_error_code(e);
|
| 814 |
+
assign(ec.value(), ec.category());
|
| 815 |
+
```
|
| 816 |
|
| 817 |
#### Modifiers <a id="syserr.errcode.modifiers">[[syserr.errcode.modifiers]]</a>
|
| 818 |
|
| 819 |
``` cpp
|
| 820 |
void assign(int val, const error_category& cat) noexcept;
|
|
|
|
| 827 |
error_code& operator=(ErrorCodeEnum e) noexcept;
|
| 828 |
```
|
| 829 |
|
| 830 |
*Constraints:* `is_error_code_enum_v<ErrorCodeEnum>` is `true`.
|
| 831 |
|
| 832 |
+
*Effects:* Equivalent to:
|
| 833 |
+
|
| 834 |
+
``` cpp
|
| 835 |
+
error_code ec = make_error_code(e);
|
| 836 |
+
assign(ec.value(), ec.category());
|
| 837 |
+
```
|
| 838 |
|
| 839 |
*Returns:* `*this`.
|
| 840 |
|
| 841 |
``` cpp
|
| 842 |
void clear() noexcept;
|
|
|
|
| 936 |
|
| 937 |
``` cpp
|
| 938 |
error_condition() noexcept;
|
| 939 |
```
|
| 940 |
|
| 941 |
+
*Effects:* Initializes `val_` with `0` and `cat_` with
|
| 942 |
+
`&generic_category()`.
|
| 943 |
|
| 944 |
``` cpp
|
| 945 |
error_condition(int val, const error_category& cat) noexcept;
|
| 946 |
```
|
| 947 |
|
| 948 |
+
*Effects:* Initializes `val_` with `val` and `cat_` with `&cat`.
|
| 949 |
|
| 950 |
``` cpp
|
| 951 |
template<class ErrorConditionEnum>
|
| 952 |
error_condition(ErrorConditionEnum e) noexcept;
|
| 953 |
```
|
| 954 |
|
| 955 |
*Constraints:* `is_error_condition_enum_v<ErrorConditionEnum>` is
|
| 956 |
`true`.
|
| 957 |
|
| 958 |
+
*Effects:* Equivalent to:
|
| 959 |
+
|
| 960 |
+
``` cpp
|
| 961 |
+
error_condition ec = make_error_condition(e);
|
| 962 |
+
assign(ec.value(), ec.category());
|
| 963 |
+
```
|
| 964 |
|
| 965 |
#### Modifiers <a id="syserr.errcondition.modifiers">[[syserr.errcondition.modifiers]]</a>
|
| 966 |
|
| 967 |
``` cpp
|
| 968 |
void assign(int val, const error_category& cat) noexcept;
|
|
|
|
| 976 |
```
|
| 977 |
|
| 978 |
*Constraints:* `is_error_condition_enum_v<ErrorConditionEnum>` is
|
| 979 |
`true`.
|
| 980 |
|
| 981 |
+
*Effects:* Equivalent to:
|
| 982 |
+
|
| 983 |
+
``` cpp
|
| 984 |
+
error_condition ec = make_error_condition(e);
|
| 985 |
+
assign(ec.value(), ec.category());
|
| 986 |
+
```
|
| 987 |
|
| 988 |
*Returns:* `*this`.
|
| 989 |
|
| 990 |
``` cpp
|
| 991 |
void clear() noexcept;
|
|
|
|
| 1025 |
error_condition make_error_condition(errc e) noexcept;
|
| 1026 |
```
|
| 1027 |
|
| 1028 |
*Returns:* `error_condition(static_cast<int>(e), generic_category())`.
|
| 1029 |
|
| 1030 |
+
### Comparison operator functions <a id="syserr.compare">[[syserr.compare]]</a>
|
| 1031 |
|
| 1032 |
``` cpp
|
| 1033 |
bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
|
| 1034 |
```
|
| 1035 |
|
|
|
|
| 1180 |
constructor.
|
| 1181 |
|
| 1182 |
[*Note 1*: The returned NTBS might be the contents of
|
| 1183 |
`what_arg + ": " + code.message()`. — *end note*]
|
| 1184 |
|
| 1185 |
+
## Stacktrace <a id="stacktrace">[[stacktrace]]</a>
|
| 1186 |
+
|
| 1187 |
+
### General <a id="stacktrace.general">[[stacktrace.general]]</a>
|
| 1188 |
+
|
| 1189 |
+
Subclause [[stacktrace]] describes components that C++ programs may use
|
| 1190 |
+
to store the stacktrace of the current thread of execution and query
|
| 1191 |
+
information about the stored stacktrace at runtime.
|
| 1192 |
+
|
| 1193 |
+
The *invocation sequence* of the current evaluation x₀ in the current
|
| 1194 |
+
thread of execution is a sequence (x₀, …, xₙ) of evaluations such that,
|
| 1195 |
+
for i ≥ 0, xᵢ is within the function invocation xᵢ₊₁
|
| 1196 |
+
[[intro.execution]].
|
| 1197 |
+
|
| 1198 |
+
A *stacktrace* is an approximate representation of an invocation
|
| 1199 |
+
sequence and consists of stacktrace entries. A *stacktrace entry*
|
| 1200 |
+
represents an evaluation in a stacktrace.
|
| 1201 |
+
|
| 1202 |
+
### Header `<stacktrace>` synopsis <a id="stacktrace.syn">[[stacktrace.syn]]</a>
|
| 1203 |
+
|
| 1204 |
+
``` cpp
|
| 1205 |
+
#include <compare> // see [compare.syn]
|
| 1206 |
+
|
| 1207 |
+
namespace std {
|
| 1208 |
+
// [stacktrace.entry], class stacktrace_entry
|
| 1209 |
+
class stacktrace_entry;
|
| 1210 |
+
|
| 1211 |
+
// [stacktrace.basic], class template basic_stacktrace
|
| 1212 |
+
template<class Allocator>
|
| 1213 |
+
class basic_stacktrace;
|
| 1214 |
+
|
| 1215 |
+
// basic_stacktrace typedef-names
|
| 1216 |
+
using stacktrace = basic_stacktrace<allocator<stacktrace_entry>>;
|
| 1217 |
+
|
| 1218 |
+
// [stacktrace.basic.nonmem], non-member functions
|
| 1219 |
+
template<class Allocator>
|
| 1220 |
+
void swap(basic_stacktrace<Allocator>& a, basic_stacktrace<Allocator>& b)
|
| 1221 |
+
noexcept(noexcept(a.swap(b)));
|
| 1222 |
+
|
| 1223 |
+
string to_string(const stacktrace_entry& f);
|
| 1224 |
+
|
| 1225 |
+
template<class Allocator>
|
| 1226 |
+
string to_string(const basic_stacktrace<Allocator>& st);
|
| 1227 |
+
|
| 1228 |
+
ostream& operator<<(ostream& os, const stacktrace_entry& f);
|
| 1229 |
+
template<class Allocator>
|
| 1230 |
+
ostream& operator<<(ostream& os, const basic_stacktrace<Allocator>& st);
|
| 1231 |
+
|
| 1232 |
+
// [stacktrace.format], formatting support
|
| 1233 |
+
template<> struct formatter<stacktrace_entry>;
|
| 1234 |
+
template<class Allocator> struct formatter<basic_stacktrace<Allocator>>;
|
| 1235 |
+
|
| 1236 |
+
namespace pmr {
|
| 1237 |
+
using stacktrace = basic_stacktrace<polymorphic_allocator<stacktrace_entry>>;
|
| 1238 |
+
}
|
| 1239 |
+
|
| 1240 |
+
// [stacktrace.basic.hash], hash support
|
| 1241 |
+
template<class T> struct hash;
|
| 1242 |
+
template<> struct hash<stacktrace_entry>;
|
| 1243 |
+
template<class Allocator> struct hash<basic_stacktrace<Allocator>>;
|
| 1244 |
+
}
|
| 1245 |
+
```
|
| 1246 |
+
|
| 1247 |
+
### Class `stacktrace_entry` <a id="stacktrace.entry">[[stacktrace.entry]]</a>
|
| 1248 |
+
|
| 1249 |
+
#### Overview <a id="stacktrace.entry.overview">[[stacktrace.entry.overview]]</a>
|
| 1250 |
+
|
| 1251 |
+
``` cpp
|
| 1252 |
+
namespace std {
|
| 1253 |
+
class stacktrace_entry {
|
| 1254 |
+
public:
|
| 1255 |
+
using native_handle_type = implementation-defined // stacktrace_entry::native_handle_type;
|
| 1256 |
+
|
| 1257 |
+
// [stacktrace.entry.cons], constructors
|
| 1258 |
+
constexpr stacktrace_entry() noexcept;
|
| 1259 |
+
constexpr stacktrace_entry(const stacktrace_entry& other) noexcept;
|
| 1260 |
+
constexpr stacktrace_entry& operator=(const stacktrace_entry& other) noexcept;
|
| 1261 |
+
|
| 1262 |
+
~stacktrace_entry();
|
| 1263 |
+
|
| 1264 |
+
// [stacktrace.entry.obs], observers
|
| 1265 |
+
constexpr native_handle_type native_handle() const noexcept;
|
| 1266 |
+
constexpr explicit operator bool() const noexcept;
|
| 1267 |
+
|
| 1268 |
+
// [stacktrace.entry.query], query
|
| 1269 |
+
string description() const;
|
| 1270 |
+
string source_file() const;
|
| 1271 |
+
uint_least32_t source_line() const;
|
| 1272 |
+
|
| 1273 |
+
// [stacktrace.entry.cmp], comparison
|
| 1274 |
+
friend constexpr bool operator==(const stacktrace_entry& x,
|
| 1275 |
+
const stacktrace_entry& y) noexcept;
|
| 1276 |
+
friend constexpr strong_ordering operator<=>(const stacktrace_entry& x,
|
| 1277 |
+
const stacktrace_entry& y) noexcept;
|
| 1278 |
+
};
|
| 1279 |
+
}
|
| 1280 |
+
```
|
| 1281 |
+
|
| 1282 |
+
An object of type `stacktrace_entry` is either empty, or represents a
|
| 1283 |
+
stacktrace entry and provides operations for querying information about
|
| 1284 |
+
it. The class `stacktrace_entry` models `regular` [[concepts.object]]
|
| 1285 |
+
and `three_way_comparable<strong_ordering>` [[cmp.concept]].
|
| 1286 |
+
|
| 1287 |
+
#### Constructors <a id="stacktrace.entry.cons">[[stacktrace.entry.cons]]</a>
|
| 1288 |
+
|
| 1289 |
+
``` cpp
|
| 1290 |
+
constexpr stacktrace_entry() noexcept;
|
| 1291 |
+
```
|
| 1292 |
+
|
| 1293 |
+
*Ensures:* `*this` is empty.
|
| 1294 |
+
|
| 1295 |
+
#### Observers <a id="stacktrace.entry.obs">[[stacktrace.entry.obs]]</a>
|
| 1296 |
+
|
| 1297 |
+
``` cpp
|
| 1298 |
+
constexpr native_handle_type native_handle() const noexcept;
|
| 1299 |
+
```
|
| 1300 |
+
|
| 1301 |
+
The semantics of this function are *implementation-defined*.
|
| 1302 |
+
|
| 1303 |
+
*Remarks:* Successive invocations of the `native_handle` function for an
|
| 1304 |
+
unchanged `stacktrace_entry` object return identical values.
|
| 1305 |
+
|
| 1306 |
+
``` cpp
|
| 1307 |
+
constexpr explicit operator bool() const noexcept;
|
| 1308 |
+
```
|
| 1309 |
+
|
| 1310 |
+
*Returns:* `false` if and only if `*this` is empty.
|
| 1311 |
+
|
| 1312 |
+
#### Query <a id="stacktrace.entry.query">[[stacktrace.entry.query]]</a>
|
| 1313 |
+
|
| 1314 |
+
[*Note 1*: All the `stacktrace_entry` query functions treat errors
|
| 1315 |
+
other than memory allocation errors as “no information available” and do
|
| 1316 |
+
not throw in that case. — *end note*]
|
| 1317 |
+
|
| 1318 |
+
``` cpp
|
| 1319 |
+
string description() const;
|
| 1320 |
+
```
|
| 1321 |
+
|
| 1322 |
+
*Returns:* A description of the evaluation represented by `*this`, or an
|
| 1323 |
+
empty string.
|
| 1324 |
+
|
| 1325 |
+
*Throws:* `bad_alloc` if memory for the internal data structures or the
|
| 1326 |
+
resulting string cannot be allocated.
|
| 1327 |
+
|
| 1328 |
+
``` cpp
|
| 1329 |
+
string source_file() const;
|
| 1330 |
+
```
|
| 1331 |
+
|
| 1332 |
+
*Returns:* The presumed or actual name of the source
|
| 1333 |
+
file [[cpp.predefined]] that lexically contains the expression or
|
| 1334 |
+
statement whose evaluation is represented by `*this`, or an empty
|
| 1335 |
+
string.
|
| 1336 |
+
|
| 1337 |
+
*Throws:* `bad_alloc` if memory for the internal data structures or the
|
| 1338 |
+
resulting string cannot be allocated.
|
| 1339 |
+
|
| 1340 |
+
``` cpp
|
| 1341 |
+
uint_least32_t source_line() const;
|
| 1342 |
+
```
|
| 1343 |
+
|
| 1344 |
+
*Returns:* `0`, or a 1-based line number that lexically relates to the
|
| 1345 |
+
evaluation represented by `*this`. If `source_file` returns the presumed
|
| 1346 |
+
name of the source file, returns the presumed line number; if
|
| 1347 |
+
`source_file` returns the actual name of the source file, returns the
|
| 1348 |
+
actual line number.
|
| 1349 |
+
|
| 1350 |
+
*Throws:* `bad_alloc` if memory for the internal data structures cannot
|
| 1351 |
+
be allocated.
|
| 1352 |
+
|
| 1353 |
+
#### Comparison <a id="stacktrace.entry.cmp">[[stacktrace.entry.cmp]]</a>
|
| 1354 |
+
|
| 1355 |
+
``` cpp
|
| 1356 |
+
friend constexpr bool operator==(const stacktrace_entry& x, const stacktrace_entry& y) noexcept;
|
| 1357 |
+
```
|
| 1358 |
+
|
| 1359 |
+
*Returns:* `true` if and only if `x` and `y` represent the same
|
| 1360 |
+
stacktrace entry or both `x` and `y` are empty.
|
| 1361 |
+
|
| 1362 |
+
### Class template `basic_stacktrace` <a id="stacktrace.basic">[[stacktrace.basic]]</a>
|
| 1363 |
+
|
| 1364 |
+
#### Overview <a id="stacktrace.basic.overview">[[stacktrace.basic.overview]]</a>
|
| 1365 |
+
|
| 1366 |
+
``` cpp
|
| 1367 |
+
namespace std {
|
| 1368 |
+
template<class Allocator>
|
| 1369 |
+
class basic_stacktrace {
|
| 1370 |
+
public:
|
| 1371 |
+
using value_type = stacktrace_entry;
|
| 1372 |
+
using const_reference = const value_type&;
|
| 1373 |
+
using reference = value_type&;
|
| 1374 |
+
using const_iterator = implementation-defined // type of basic_stacktrace::const_iterator; // see [stacktrace.basic.obs]
|
| 1375 |
+
using iterator = const_iterator;
|
| 1376 |
+
using reverse_iterator = std::reverse_iterator<iterator>;
|
| 1377 |
+
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
| 1378 |
+
using difference_type = implementation-defined // type of basic_stacktrace::difference_type;
|
| 1379 |
+
using size_type = implementation-defined // type of basic_stacktrace::size_type;
|
| 1380 |
+
using allocator_type = Allocator;
|
| 1381 |
+
|
| 1382 |
+
// [stacktrace.basic.cons], creation and assignment
|
| 1383 |
+
static basic_stacktrace current(const allocator_type& alloc = allocator_type()) noexcept;
|
| 1384 |
+
static basic_stacktrace current(size_type skip,
|
| 1385 |
+
const allocator_type& alloc = allocator_type()) noexcept;
|
| 1386 |
+
static basic_stacktrace current(size_type skip, size_type max_depth,
|
| 1387 |
+
const allocator_type& alloc = allocator_type()) noexcept;
|
| 1388 |
+
|
| 1389 |
+
basic_stacktrace() noexcept(is_nothrow_default_constructible_v<allocator_type>);
|
| 1390 |
+
explicit basic_stacktrace(const allocator_type& alloc) noexcept;
|
| 1391 |
+
|
| 1392 |
+
basic_stacktrace(const basic_stacktrace& other);
|
| 1393 |
+
basic_stacktrace(basic_stacktrace&& other) noexcept;
|
| 1394 |
+
basic_stacktrace(const basic_stacktrace& other, const allocator_type& alloc);
|
| 1395 |
+
basic_stacktrace(basic_stacktrace&& other, const allocator_type& alloc);
|
| 1396 |
+
basic_stacktrace& operator=(const basic_stacktrace& other);
|
| 1397 |
+
basic_stacktrace& operator=(basic_stacktrace&& other)
|
| 1398 |
+
noexcept(allocator_traits<Allocator>::propagate_on_container_move_assignment::value ||
|
| 1399 |
+
allocator_traits<Allocator>::is_always_equal::value);
|
| 1400 |
+
|
| 1401 |
+
~basic_stacktrace();
|
| 1402 |
+
|
| 1403 |
+
// [stacktrace.basic.obs], observers
|
| 1404 |
+
allocator_type get_allocator() const noexcept;
|
| 1405 |
+
|
| 1406 |
+
const_iterator begin() const noexcept;
|
| 1407 |
+
const_iterator end() const noexcept;
|
| 1408 |
+
const_reverse_iterator rbegin() const noexcept;
|
| 1409 |
+
const_reverse_iterator rend() const noexcept;
|
| 1410 |
+
|
| 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 |
+
[[nodiscard]] bool empty() const noexcept;
|
| 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;
|
| 1422 |
+
|
| 1423 |
+
// [stacktrace.basic.cmp], comparisons
|
| 1424 |
+
template<class Allocator2>
|
| 1425 |
+
friend bool operator==(const basic_stacktrace& x,
|
| 1426 |
+
const basic_stacktrace<Allocator2>& y) noexcept;
|
| 1427 |
+
template<class Allocator2>
|
| 1428 |
+
friend strong_ordering operator<=>(const basic_stacktrace& x,
|
| 1429 |
+
const basic_stacktrace<Allocator2>& y) noexcept;
|
| 1430 |
+
|
| 1431 |
+
// [stacktrace.basic.mod], modifiers
|
| 1432 |
+
void swap(basic_stacktrace& other)
|
| 1433 |
+
noexcept(allocator_traits<Allocator>::propagate_on_container_swap::value ||
|
| 1434 |
+
allocator_traits<Allocator>::is_always_equal::value);
|
| 1435 |
+
|
| 1436 |
+
private:
|
| 1437 |
+
vector<value_type, allocator_type> frames_; // exposition only
|
| 1438 |
+
};
|
| 1439 |
+
}
|
| 1440 |
+
```
|
| 1441 |
+
|
| 1442 |
+
The class template `basic_stacktrace` satisfies the requirements of a
|
| 1443 |
+
reversible container [[container.rev.reqmts]], of an allocator-aware
|
| 1444 |
+
container [[container.alloc.reqmts]], and of a sequence container
|
| 1445 |
+
[[sequence.reqmts]], except that
|
| 1446 |
+
|
| 1447 |
+
- only move, assignment, swap, and operations defined for
|
| 1448 |
+
const-qualified sequence containers are supported and,
|
| 1449 |
+
- the semantics of comparison functions are different from those
|
| 1450 |
+
required for a container.
|
| 1451 |
+
|
| 1452 |
+
#### Creation and assignment <a id="stacktrace.basic.cons">[[stacktrace.basic.cons]]</a>
|
| 1453 |
+
|
| 1454 |
+
``` cpp
|
| 1455 |
+
static basic_stacktrace current(const allocator_type& alloc = allocator_type()) noexcept;
|
| 1456 |
+
```
|
| 1457 |
+
|
| 1458 |
+
*Returns:* A `basic_stacktrace` object with `frames_` storing the
|
| 1459 |
+
stacktrace of the current evaluation in the current thread of execution,
|
| 1460 |
+
or an empty `basic_stacktrace` object if the initialization of `frames_`
|
| 1461 |
+
failed. `alloc` is passed to the constructor of the `frames_` object.
|
| 1462 |
+
|
| 1463 |
+
[*Note 1*: If the stacktrace was successfully obtained, then
|
| 1464 |
+
`frames_.front()` is the `stacktrace_entry` representing approximately
|
| 1465 |
+
the current evaluation, and `frames_.back()` is the `stacktrace_entry`
|
| 1466 |
+
representing approximately the initial function of the current thread 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 `frames_` is
|
| 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 `frames_` failed.
|
| 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 |
+
*Preconditions:* `skip <= skip + max_depth` is `true`.
|
| 1491 |
+
|
| 1492 |
+
*Returns:* A `basic_stacktrace` object where `frames_` is
|
| 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 `frames_` failed.
|
| 1496 |
+
|
| 1497 |
+
``` cpp
|
| 1498 |
+
basic_stacktrace() noexcept(is_nothrow_default_constructible_v<allocator_type>);
|
| 1499 |
+
```
|
| 1500 |
+
|
| 1501 |
+
*Ensures:* `empty()` is `true`.
|
| 1502 |
+
|
| 1503 |
+
``` cpp
|
| 1504 |
+
explicit basic_stacktrace(const allocator_type& alloc) noexcept;
|
| 1505 |
+
```
|
| 1506 |
+
|
| 1507 |
+
*Effects:* `alloc` is passed to the `frames_` constructor.
|
| 1508 |
+
|
| 1509 |
+
*Ensures:* `empty()` is `true`.
|
| 1510 |
+
|
| 1511 |
+
``` cpp
|
| 1512 |
+
basic_stacktrace(const basic_stacktrace& other);
|
| 1513 |
+
basic_stacktrace(const basic_stacktrace& other, const allocator_type& alloc);
|
| 1514 |
+
basic_stacktrace(basic_stacktrace&& other, const allocator_type& alloc);
|
| 1515 |
+
basic_stacktrace& operator=(const basic_stacktrace& other);
|
| 1516 |
+
basic_stacktrace& operator=(basic_stacktrace&& other)
|
| 1517 |
+
noexcept(allocator_traits<Allocator>::propagate_on_container_move_assignment::value ||
|
| 1518 |
+
allocator_traits<Allocator>::is_always_equal::value);
|
| 1519 |
+
```
|
| 1520 |
+
|
| 1521 |
+
*Remarks:* Implementations may strengthen the exception specification
|
| 1522 |
+
for these functions [[res.on.exception.handling]] by ensuring that
|
| 1523 |
+
`empty()` is `true` on failed allocation.
|
| 1524 |
+
|
| 1525 |
+
#### Observers <a id="stacktrace.basic.obs">[[stacktrace.basic.obs]]</a>
|
| 1526 |
+
|
| 1527 |
+
``` cpp
|
| 1528 |
+
using const_iterator = implementation-defined;
|
| 1529 |
+
```
|
| 1530 |
+
|
| 1531 |
+
The type models `random_access_iterator`
|
| 1532 |
+
[[iterator.concept.random.access]] and meets the
|
| 1533 |
+
*Cpp17RandomAccessIterator* requirements [[random.access.iterators]].
|
| 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 `frames_`. If
|
| 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;
|
| 1552 |
+
```
|
| 1553 |
+
|
| 1554 |
+
*Returns:* The end iterator.
|
| 1555 |
+
|
| 1556 |
+
``` cpp
|
| 1557 |
+
const_reverse_iterator rbegin() const noexcept;
|
| 1558 |
+
const_reverse_iterator crbegin() const noexcept;
|
| 1559 |
+
```
|
| 1560 |
+
|
| 1561 |
+
*Returns:* `reverse_iterator(cend())`.
|
| 1562 |
+
|
| 1563 |
+
``` cpp
|
| 1564 |
+
const_reverse_iterator rend() const noexcept;
|
| 1565 |
+
const_reverse_iterator crend() const noexcept;
|
| 1566 |
+
```
|
| 1567 |
+
|
| 1568 |
+
*Returns:* `reverse_iterator(cbegin())`.
|
| 1569 |
+
|
| 1570 |
+
``` cpp
|
| 1571 |
+
[[nodiscard]] bool empty() const noexcept;
|
| 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 |
+
*Preconditions:* `frame_no < size()` is `true`.
|
| 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 |
+
|
| 1608 |
+
``` cpp
|
| 1609 |
+
template<class Allocator2>
|
| 1610 |
+
friend bool operator==(const basic_stacktrace& x, const basic_stacktrace<Allocator2>& y) noexcept;
|
| 1611 |
+
```
|
| 1612 |
+
|
| 1613 |
+
*Returns:* `equal(x.begin(), x.end(), y.begin(), y.end())`.
|
| 1614 |
+
|
| 1615 |
+
``` cpp
|
| 1616 |
+
template<class Allocator2>
|
| 1617 |
+
friend strong_ordering
|
| 1618 |
+
operator<=>(const basic_stacktrace& x, const basic_stacktrace<Allocator2>& y) noexcept;
|
| 1619 |
+
```
|
| 1620 |
+
|
| 1621 |
+
*Returns:* `x.size() <=> y.size()` if `x.size() != y.size()`;
|
| 1622 |
+
`lexicographical_compare_three_way(x.begin(), x.end(), y.begin(), y.end())`
|
| 1623 |
+
otherwise.
|
| 1624 |
+
|
| 1625 |
+
#### Modifiers <a id="stacktrace.basic.mod">[[stacktrace.basic.mod]]</a>
|
| 1626 |
+
|
| 1627 |
+
``` cpp
|
| 1628 |
+
void swap(basic_stacktrace& other)
|
| 1629 |
+
noexcept(allocator_traits<Allocator>::propagate_on_container_swap::value ||
|
| 1630 |
+
allocator_traits<Allocator>::is_always_equal::value);
|
| 1631 |
+
```
|
| 1632 |
+
|
| 1633 |
+
*Effects:* Exchanges the contents of `*this` and `other`.
|
| 1634 |
+
|
| 1635 |
+
#### Non-member functions <a id="stacktrace.basic.nonmem">[[stacktrace.basic.nonmem]]</a>
|
| 1636 |
+
|
| 1637 |
+
``` cpp
|
| 1638 |
+
template<class Allocator>
|
| 1639 |
+
void swap(basic_stacktrace<Allocator>& a, basic_stacktrace<Allocator>& b)
|
| 1640 |
+
noexcept(noexcept(a.swap(b)));
|
| 1641 |
+
```
|
| 1642 |
+
|
| 1643 |
+
*Effects:* Equivalent to `a.swap(b)`.
|
| 1644 |
+
|
| 1645 |
+
``` cpp
|
| 1646 |
+
string to_string(const stacktrace_entry& f);
|
| 1647 |
+
```
|
| 1648 |
+
|
| 1649 |
+
*Returns:* A string with a description of `f`.
|
| 1650 |
+
|
| 1651 |
+
*Recommended practice:* The description should provide information about
|
| 1652 |
+
the contained evaluation, including information from `f.source_file()`
|
| 1653 |
+
and `f.source_line()`.
|
| 1654 |
+
|
| 1655 |
+
``` cpp
|
| 1656 |
+
template<class Allocator>
|
| 1657 |
+
string to_string(const basic_stacktrace<Allocator>& st);
|
| 1658 |
+
```
|
| 1659 |
+
|
| 1660 |
+
*Returns:* A string with a description of `st`.
|
| 1661 |
+
|
| 1662 |
+
[*Note 1*: The number of lines is not guaranteed to be equal to
|
| 1663 |
+
`st.size()`. — *end note*]
|
| 1664 |
+
|
| 1665 |
+
``` cpp
|
| 1666 |
+
ostream& operator<<(ostream& os, const stacktrace_entry& f);
|
| 1667 |
+
```
|
| 1668 |
+
|
| 1669 |
+
*Effects:* Equivalent to: `return os << to_string(f);`
|
| 1670 |
+
|
| 1671 |
+
``` cpp
|
| 1672 |
+
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 |
+
#### Formatting support <a id="stacktrace.format">[[stacktrace.format]]</a>
|
| 1679 |
+
|
| 1680 |
+
``` cpp
|
| 1681 |
+
template<> struct formatter<stacktrace_entry>;
|
| 1682 |
+
```
|
| 1683 |
+
|
| 1684 |
+
`formatter<stacktrace_entry>` interprets *format-spec* as a
|
| 1685 |
+
*stacktrace-entry-format-spec*. The syntax of format specifications is
|
| 1686 |
+
as follows:
|
| 1687 |
+
|
| 1688 |
+
``` bnf
|
| 1689 |
+
stacktrace-entry-format-spec
|
| 1690 |
+
fill-and-alignₒₚₜ widthₒₚₜ
|
| 1691 |
+
```
|
| 1692 |
+
|
| 1693 |
+
[*Note 1*: The productions *fill-and-align* and *width* are described
|
| 1694 |
+
in [[format.string.std]]. — *end note*]
|
| 1695 |
+
|
| 1696 |
+
A `stacktrace_entry` object `se` is formatted as if by copying
|
| 1697 |
+
`to_string(se)` through the output iterator of the context with
|
| 1698 |
+
additional padding and adjustments as specified by the format
|
| 1699 |
+
specifiers.
|
| 1700 |
+
|
| 1701 |
+
``` cpp
|
| 1702 |
+
template<class Allocator> struct formatter<basic_stacktrace<Allocator>>;
|
| 1703 |
+
```
|
| 1704 |
+
|
| 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 |
+
#### Hash support <a id="stacktrace.basic.hash">[[stacktrace.basic.hash]]</a>
|
| 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
|
| 1724 |
[cassert.syn]: #cassert.syn
|
| 1725 |
[cerrno.syn]: #cerrno.syn
|
| 1726 |
+
[cmp.concept]: support.md#cmp.concept
|
| 1727 |
[comparisons.three.way]: utilities.md#comparisons.three.way
|
| 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]: utilities.md#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
|
| 1746 |
[out.of.range]: #out.of.range
|
| 1747 |
[overflow.error]: #overflow.error
|
| 1748 |
+
[random.access.iterators]: iterators.md#random.access.iterators
|
| 1749 |
[range.error]: #range.error
|
| 1750 |
[res.on.exception.handling]: library.md#res.on.exception.handling
|
| 1751 |
[runtime.error]: #runtime.error
|
| 1752 |
+
[sequence.reqmts]: containers.md#sequence.reqmts
|
| 1753 |
+
[stacktrace]: #stacktrace
|
| 1754 |
+
[stacktrace.basic]: #stacktrace.basic
|
| 1755 |
+
[stacktrace.basic.cmp]: #stacktrace.basic.cmp
|
| 1756 |
+
[stacktrace.basic.cons]: #stacktrace.basic.cons
|
| 1757 |
+
[stacktrace.basic.hash]: #stacktrace.basic.hash
|
| 1758 |
+
[stacktrace.basic.mod]: #stacktrace.basic.mod
|
| 1759 |
+
[stacktrace.basic.nonmem]: #stacktrace.basic.nonmem
|
| 1760 |
+
[stacktrace.basic.obs]: #stacktrace.basic.obs
|
| 1761 |
+
[stacktrace.basic.overview]: #stacktrace.basic.overview
|
| 1762 |
+
[stacktrace.entry]: #stacktrace.entry
|
| 1763 |
+
[stacktrace.entry.cmp]: #stacktrace.entry.cmp
|
| 1764 |
+
[stacktrace.entry.cons]: #stacktrace.entry.cons
|
| 1765 |
+
[stacktrace.entry.obs]: #stacktrace.entry.obs
|
| 1766 |
+
[stacktrace.entry.overview]: #stacktrace.entry.overview
|
| 1767 |
+
[stacktrace.entry.query]: #stacktrace.entry.query
|
| 1768 |
+
[stacktrace.format]: #stacktrace.format
|
| 1769 |
+
[stacktrace.general]: #stacktrace.general
|
| 1770 |
+
[stacktrace.syn]: #stacktrace.syn
|
| 1771 |
[std.exceptions]: #std.exceptions
|
| 1772 |
+
[std.exceptions.general]: #std.exceptions.general
|
| 1773 |
[stdexcept.syn]: #stdexcept.syn
|
| 1774 |
[syserr]: #syserr
|
| 1775 |
[syserr.compare]: #syserr.compare
|
| 1776 |
[syserr.errcat]: #syserr.errcat
|
| 1777 |
[syserr.errcat.derived]: #syserr.errcat.derived
|
|
|
|
| 1789 |
[syserr.errcondition.constructors]: #syserr.errcondition.constructors
|
| 1790 |
[syserr.errcondition.modifiers]: #syserr.errcondition.modifiers
|
| 1791 |
[syserr.errcondition.nonmembers]: #syserr.errcondition.nonmembers
|
| 1792 |
[syserr.errcondition.observers]: #syserr.errcondition.observers
|
| 1793 |
[syserr.errcondition.overview]: #syserr.errcondition.overview
|
| 1794 |
+
[syserr.general]: #syserr.general
|
| 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
|