Bewerken

Delen via


nested_exception Class

The class describes an exception for use with multiple inheritance. It captures the currently handled exception and stores it for later use.

Syntax

class nested_exception {
    public:
        nested_exception();
        nested_exception(const nested_exception&) = default;
        virtual ~nested_exception() = default; // access functions
};

Members

Operators

Name Description
operator= Assignment operator.

Functions

Name Description
rethrow_nested Throws the stored exception.
nested_ptr Returns the stored exception.

operator=

nested_exception& operator=(const nested_exception&) = default;

nested_ptr

exception_ptr nested_ptr() const;

Return Value

The stored exception captured by this nested_exception object.

rethrow_nested

[[noreturn]] void rethrow_nested() const;

Remarks

If nested_ptr() returns a null pointer, the function calls std::terminate(). Otherwise, it throws the stored exception captured by *this.

Requirements

Header: <exception>

Namespace: std

See also

exception Class
Thread Safety in the C++ Standard Library