cpp/error/current exception

If called during exception handling (typically, in a clause), captures the current exception object and creates an std 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 object that refers to it.

If the implementation of this function requires a call to and the call fails, the returned pointer will hold a reference to an instance of std.

If the implementation of this function requires copying the captured exception object and its copy constructor throws an exception, the returned pointer will hold a reference to the exception thrown. If the copy constructor of the thrown exception object also throws, the returned pointer may hold a reference to an instance of std to break the endless loop.

If the function is called when no exception is being handled, an empty std is returned.

Parameters
(none)

Return value
An instance of std holding a reference to the exception object, or a copy of the exception object, or to an instance of std or to an instance of std.