devxlogo

The std::unexpected() Function

The std::unexpected() Function

The Standard Library defines a function called std::unexpected() which is invoked when a function throws an exception not listed in its exception specification. std::unexpected invokes a user-defined function that was registered by std::set_unexpected. If the user hasn’t registered such a function, unexpected() will invoke std::terminate(), which in turn calls abort() and terminates the program. All these functions are declared in the standard header .

devx-admin

Share the Post: