class bad_exception : public exception
std::bad_exception
is the type of the exception thrown by the C++ runtime in the following situations:
std::bad_exception
.std::bad_exception
, std::bad_exception
is thrown.Inheritance diagram
All member functions of std::bad_exception
are constexpr.
bad_exception
object
std::exception
) [edit] returns an explanatory string
std::exception
) [edit] [edit] Notes [edit] Example
Compiles only in C++14 or earlier modes (may issue warnings).
#include <exception> #include <iostream> #include <stdexcept> void my_unexp() { throw; } void test() throw(std::bad_exception) // Dynamic exception specifications // are deprecated in C++11 { throw std::runtime_error("test"); } int main() { std::set_unexpected(my_unexp); // Deprecated in C++11, removed in C++17 try { test(); } catch (const std::bad_exception& e) { std::cerr << "Caught " << e.what() << '\n'; } }
Possible output:
Caught std::bad_exception
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4