tmp/tmpp2ucdn9x/{from.md → to.md}
RENAMED
|
@@ -2,22 +2,22 @@
|
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
class nested_exception {
|
| 6 |
public:
|
| 7 |
-
nested_exception() noexcept;
|
| 8 |
-
nested_exception(const nested_exception&) noexcept = default;
|
| 9 |
-
nested_exception& operator=(const nested_exception&) noexcept = default;
|
| 10 |
-
virtual ~nested_exception() = default;
|
| 11 |
|
| 12 |
// access functions
|
| 13 |
-
[[noreturn]] void rethrow_nested() const;
|
| 14 |
-
exception_ptr nested_ptr() const noexcept;
|
| 15 |
};
|
| 16 |
|
| 17 |
-
template<class T> [[noreturn]] void throw_with_nested(T&& t);
|
| 18 |
-
template<class E> void rethrow_if_nested(const E& e);
|
| 19 |
}
|
| 20 |
```
|
| 21 |
|
| 22 |
The class `nested_exception` is designed for use as a mixin through
|
| 23 |
multiple inheritance. It captures the currently handled exception and
|
|
@@ -26,33 +26,33 @@ stores it for later use.
|
|
| 26 |
[*Note 1*: `nested_exception` has a virtual destructor to make it a
|
| 27 |
polymorphic class. Its presence can be tested for with
|
| 28 |
`dynamic_cast`. — *end note*]
|
| 29 |
|
| 30 |
``` cpp
|
| 31 |
-
nested_exception() noexcept;
|
| 32 |
```
|
| 33 |
|
| 34 |
*Effects:* The constructor calls `current_exception()` and stores the
|
| 35 |
returned value.
|
| 36 |
|
| 37 |
``` cpp
|
| 38 |
-
[[noreturn]] void rethrow_nested() const;
|
| 39 |
```
|
| 40 |
|
| 41 |
*Effects:* If `nested_ptr()` returns a null pointer, the function calls
|
| 42 |
the function `std::terminate`. Otherwise, it throws the stored exception
|
| 43 |
captured by `*this`.
|
| 44 |
|
| 45 |
``` cpp
|
| 46 |
-
exception_ptr nested_ptr() const noexcept;
|
| 47 |
```
|
| 48 |
|
| 49 |
*Returns:* The stored exception captured by this `nested_exception`
|
| 50 |
object.
|
| 51 |
|
| 52 |
``` cpp
|
| 53 |
-
template<class T> [[noreturn]] void throw_with_nested(T&& t);
|
| 54 |
```
|
| 55 |
|
| 56 |
Let `U` be `decay_t<T>`.
|
| 57 |
|
| 58 |
*Preconditions:* `U` meets the *Cpp17CopyConstructible* requirements.
|
|
@@ -62,11 +62,11 @@ Let `U` be `decay_t<T>`.
|
|
| 62 |
is `true`, an exception of unspecified type that is publicly derived
|
| 63 |
from both `U` and `nested_exception` and constructed from
|
| 64 |
`std::forward<T>(t)`, otherwise `std::forward<T>(t)`.
|
| 65 |
|
| 66 |
``` cpp
|
| 67 |
-
template<class E> void rethrow_if_nested(const E& e);
|
| 68 |
```
|
| 69 |
|
| 70 |
*Effects:* If `E` is not a polymorphic class type, or if
|
| 71 |
`nested_exception` is an inaccessible or ambiguous base class of `E`,
|
| 72 |
there is no effect. Otherwise, performs:
|
|
|
|
| 2 |
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
class nested_exception {
|
| 6 |
public:
|
| 7 |
+
constexpr nested_exception() noexcept;
|
| 8 |
+
constexpr nested_exception(const nested_exception&) noexcept = default;
|
| 9 |
+
constexpr nested_exception& operator=(const nested_exception&) noexcept = default;
|
| 10 |
+
constexpr virtual ~nested_exception() = default;
|
| 11 |
|
| 12 |
// access functions
|
| 13 |
+
[[noreturn]] constexpr void rethrow_nested() const;
|
| 14 |
+
constexpr exception_ptr nested_ptr() const noexcept;
|
| 15 |
};
|
| 16 |
|
| 17 |
+
template<class T> [[noreturn]] constexpr void throw_with_nested(T&& t);
|
| 18 |
+
template<class E> constexpr void rethrow_if_nested(const E& e);
|
| 19 |
}
|
| 20 |
```
|
| 21 |
|
| 22 |
The class `nested_exception` is designed for use as a mixin through
|
| 23 |
multiple inheritance. It captures the currently handled exception and
|
|
|
|
| 26 |
[*Note 1*: `nested_exception` has a virtual destructor to make it a
|
| 27 |
polymorphic class. Its presence can be tested for with
|
| 28 |
`dynamic_cast`. — *end note*]
|
| 29 |
|
| 30 |
``` cpp
|
| 31 |
+
constexpr nested_exception() noexcept;
|
| 32 |
```
|
| 33 |
|
| 34 |
*Effects:* The constructor calls `current_exception()` and stores the
|
| 35 |
returned value.
|
| 36 |
|
| 37 |
``` cpp
|
| 38 |
+
[[noreturn]] constexpr void rethrow_nested() const;
|
| 39 |
```
|
| 40 |
|
| 41 |
*Effects:* If `nested_ptr()` returns a null pointer, the function calls
|
| 42 |
the function `std::terminate`. Otherwise, it throws the stored exception
|
| 43 |
captured by `*this`.
|
| 44 |
|
| 45 |
``` cpp
|
| 46 |
+
constexpr exception_ptr nested_ptr() const noexcept;
|
| 47 |
```
|
| 48 |
|
| 49 |
*Returns:* The stored exception captured by this `nested_exception`
|
| 50 |
object.
|
| 51 |
|
| 52 |
``` cpp
|
| 53 |
+
template<class T> [[noreturn]] constexpr void throw_with_nested(T&& t);
|
| 54 |
```
|
| 55 |
|
| 56 |
Let `U` be `decay_t<T>`.
|
| 57 |
|
| 58 |
*Preconditions:* `U` meets the *Cpp17CopyConstructible* requirements.
|
|
|
|
| 62 |
is `true`, an exception of unspecified type that is publicly derived
|
| 63 |
from both `U` and `nested_exception` and constructed from
|
| 64 |
`std::forward<T>(t)`, otherwise `std::forward<T>(t)`.
|
| 65 |
|
| 66 |
``` cpp
|
| 67 |
+
template<class E> constexpr void rethrow_if_nested(const E& e);
|
| 68 |
```
|
| 69 |
|
| 70 |
*Effects:* If `E` is not a polymorphic class type, or if
|
| 71 |
`nested_exception` is an inaccessible or ambiguous base class of `E`,
|
| 72 |
there is no effect. Otherwise, performs:
|