该类描述用于多个继承的异常。 它捕获当前处理的异常,并存储它供以后使用。
语法
class nested_exception {
public:
nested_exception();
nested_exception(const nested_exception&) = default;
virtual ~nested_exception() = default; // access functions
};
成员
运算符
| 名称 | 描述 |
|---|---|
| operator= | 赋值运算符。 |
函数
| 名称 | 描述 |
|---|---|
| rethrow_nested | 引发存储的异常。 |
| nested_ptr | 返回存储的异常。 |
operator=
nested_exception& operator=(const nested_exception&) = default;
nested_ptr
exception_ptr nested_ptr() const;
返回值
由此 nested_exception 对象捕获的存储的异常。
rethrow_nested
[[noreturn]] void rethrow_nested() const;
注解
如果 nested_ptr() 返回空指针,则该函数调用 std::terminate()。 否则,它会引发由 *this 捕获的存储的异常。
要求
标头:<exception>
命名空间: std