tmp/tmpo2z033p3/{from.md → to.md}
RENAMED
|
@@ -22,21 +22,23 @@ enumeration, or pointer type.
|
|
| 22 |
as `exception_ptr`. — *end note*]
|
| 23 |
|
| 24 |
For purposes of determining the presence of a data race, operations on
|
| 25 |
`exception_ptr` objects shall access and modify only the `exception_ptr`
|
| 26 |
objects themselves and not the exceptions they refer to. Use of
|
| 27 |
-
`rethrow_exception` on `exception_ptr` objects
|
| 28 |
-
exception object shall not introduce a data race.
|
| 29 |
|
| 30 |
[*Note 2*: If `rethrow_exception` rethrows the same exception object
|
| 31 |
(rather than a copy), concurrent access to that rethrown exception
|
| 32 |
object can introduce a data race. Changes in the number of
|
| 33 |
`exception_ptr` objects that refer to a particular exception do not
|
| 34 |
introduce a data race. — *end note*]
|
| 35 |
|
|
|
|
|
|
|
| 36 |
``` cpp
|
| 37 |
-
exception_ptr current_exception() noexcept;
|
| 38 |
```
|
| 39 |
|
| 40 |
*Returns:* An `exception_ptr` object that refers to the currently
|
| 41 |
handled exception [[except.handle]] or a copy of the currently handled
|
| 42 |
exception, or a null `exception_ptr` object if no exception is being
|
|
@@ -54,15 +56,15 @@ If the attempt to copy the current exception object throws an exception,
|
|
| 54 |
the function returns an `exception_ptr` object that refers to the thrown
|
| 55 |
exception or, if this is not possible, to an instance of
|
| 56 |
`bad_exception`.
|
| 57 |
|
| 58 |
[*Note 4*: The copy constructor of the thrown exception can also fail,
|
| 59 |
-
so the implementation
|
| 60 |
-
|
| 61 |
|
| 62 |
``` cpp
|
| 63 |
-
[[noreturn]] void rethrow_exception(exception_ptr p);
|
| 64 |
```
|
| 65 |
|
| 66 |
*Preconditions:* `p` is not a null pointer.
|
| 67 |
|
| 68 |
*Effects:* Let u be the exception object to which `p` refers, or a copy
|
|
@@ -74,11 +76,11 @@ memory for the copy is allocated in an unspecified way.
|
|
| 74 |
- otherwise, if copying the exception to which `p` refers to form u
|
| 75 |
throws an exception, throws that exception;
|
| 76 |
- otherwise, throws u.
|
| 77 |
|
| 78 |
``` cpp
|
| 79 |
-
template<class E> exception_ptr make_exception_ptr(E e) noexcept;
|
| 80 |
```
|
| 81 |
|
| 82 |
*Effects:* Creates an `exception_ptr` object that refers to a copy of
|
| 83 |
`e`, as if:
|
| 84 |
|
|
@@ -91,5 +93,20 @@ try {
|
|
| 91 |
```
|
| 92 |
|
| 93 |
[*Note 5*: This function is provided for convenience and efficiency
|
| 94 |
reasons. — *end note*]
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
as `exception_ptr`. — *end note*]
|
| 23 |
|
| 24 |
For purposes of determining the presence of a data race, operations on
|
| 25 |
`exception_ptr` objects shall access and modify only the `exception_ptr`
|
| 26 |
objects themselves and not the exceptions they refer to. Use of
|
| 27 |
+
`rethrow_exception` or `exception_ptr_cast` on `exception_ptr` objects
|
| 28 |
+
that refer to the same exception object shall not introduce a data race.
|
| 29 |
|
| 30 |
[*Note 2*: If `rethrow_exception` rethrows the same exception object
|
| 31 |
(rather than a copy), concurrent access to that rethrown exception
|
| 32 |
object can introduce a data race. Changes in the number of
|
| 33 |
`exception_ptr` objects that refer to a particular exception do not
|
| 34 |
introduce a data race. — *end note*]
|
| 35 |
|
| 36 |
+
All member functions are marked `constexpr`.
|
| 37 |
+
|
| 38 |
``` cpp
|
| 39 |
+
constexpr exception_ptr current_exception() noexcept;
|
| 40 |
```
|
| 41 |
|
| 42 |
*Returns:* An `exception_ptr` object that refers to the currently
|
| 43 |
handled exception [[except.handle]] or a copy of the currently handled
|
| 44 |
exception, or a null `exception_ptr` object if no exception is being
|
|
|
|
| 56 |
the function returns an `exception_ptr` object that refers to the thrown
|
| 57 |
exception or, if this is not possible, to an instance of
|
| 58 |
`bad_exception`.
|
| 59 |
|
| 60 |
[*Note 4*: The copy constructor of the thrown exception can also fail,
|
| 61 |
+
so the implementation can substitute a `bad_exception` object to avoid
|
| 62 |
+
infinite recursion. — *end note*]
|
| 63 |
|
| 64 |
``` cpp
|
| 65 |
+
[[noreturn]] constexpr void rethrow_exception(exception_ptr p);
|
| 66 |
```
|
| 67 |
|
| 68 |
*Preconditions:* `p` is not a null pointer.
|
| 69 |
|
| 70 |
*Effects:* Let u be the exception object to which `p` refers, or a copy
|
|
|
|
| 76 |
- otherwise, if copying the exception to which `p` refers to form u
|
| 77 |
throws an exception, throws that exception;
|
| 78 |
- otherwise, throws u.
|
| 79 |
|
| 80 |
``` cpp
|
| 81 |
+
template<class E> constexpr exception_ptr make_exception_ptr(E e) noexcept;
|
| 82 |
```
|
| 83 |
|
| 84 |
*Effects:* Creates an `exception_ptr` object that refers to a copy of
|
| 85 |
`e`, as if:
|
| 86 |
|
|
|
|
| 93 |
```
|
| 94 |
|
| 95 |
[*Note 5*: This function is provided for convenience and efficiency
|
| 96 |
reasons. — *end note*]
|
| 97 |
|
| 98 |
+
``` cpp
|
| 99 |
+
template<class E> constexpr const E* exception_ptr_cast(const exception_ptr& p) noexcept;
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
*Mandates:* `E` is a cv-unqualified complete object type. `E` is not an
|
| 103 |
+
array type. `E` is not a pointer or pointer-to-member type.
|
| 104 |
+
|
| 105 |
+
[*Note 6*: When `E` is a pointer or pointer-to-member type, a handler
|
| 106 |
+
of type `const E&` can match without binding to the exception object
|
| 107 |
+
itself. — *end note*]
|
| 108 |
+
|
| 109 |
+
*Returns:* A pointer to the exception object referred to by `p`, if `p`
|
| 110 |
+
is not null and a handler of type `const E&` would be a
|
| 111 |
+
match [[except.handle]] for that exception object. Otherwise, `nullptr`.
|
| 112 |
+
|