This header defines the base class for all standard exceptions thrown by the elements of the standard library: exception
. It also defines the special exception bad_exception
It also provides elements to access the unexpected
When an exception is thrown, its type is checked twice:
- First, if the function has an exception-specification
specifier at the function signature), the type is checked against these. If the type does not match, unexpected
- Second, the exception type is checked against the exception handlers (catch
blocks). If it does not match at any nesting level, terminate
This header defines both unexpected
along with functions to override their default behavior.
It also defines a function, uncaught_exception
that returns whether an exception has been thrown and not yet handled.
Contents of <exception>:
|unexpected|| Function handling unexpected exceptions (function)|
|terminate|| Function handling termination on exception (function)|