Documentation Home >> Headers >> <exception_ptr> Header >> std::exception_ptr class

An instance of std::exception_ptr stores a captured exception for later rethrow either on the same or another thread. Instances of std::exception_ptr may be used directly to transfer an exception between threads, or may be used alongside std::promise, std::future and std::shared_future.

Instances of std::exception_ptr are CopyAssignable and CopyConstructible.

class exception_ptr
{
public:
    exception_ptr();
    ~exception_ptr();

    exception_ptr(exception_ptr const& );
    exception_ptr& operator=(exception_ptr const& );

    explicit operator bool() const;

    void swap(exception_ptr&);

    bool operator==(exception_ptr const& ) const;
    bool operator!=(exception_ptr const& ) const;
};
Header

#include <exception_ptr>

See Also