function
<exception>

std::get_unexpected

unexpected_handler get_unexpected() noexcept;
Get unexpected handler function
Gets the unexpected handler function.

The unexpected handler function is automatically called when a function throws an exception that is not in its dynamic-exception-specification (i.e., in its throw specifier).

If no such function has been set by a previous call to set_unexpected, the function may return a null-pointer (although some implementations may also return a valid function pointer that calls terminate).

Parameters

none

Return value

If set_unexpected has previously been called by the program, the function returns the current unexpected handler function.
Otherwise, it returns an unspecified value (either a null-pointer or a valid function pointer).

unexpected_handler is a function pointer type taking no arguments and returning no value.

Compatibility

The use of dynamic-exception-specifiers is deprecated (since C++11).

Data races

Calling this function does not introduce data races, and is synchronized with the calls to set_unexpected.

Exception safety

No-throw guarantee: this function never throws exceptions.

See also