std::current_exception

std::current_exception

Defined in header <exception>
std::exception_ptr current_exception();
(since C++11)

If called during exception handling (typically, in a catch clause), captures the current exception object and creates an std::exception_ptr that holds either a copy or a reference to that exception object (depending on the implementation). The referenced object remains valid at least as long as there is an exception_ptr object that refe