std::bad_exception - cppreference.com
提供: cppreference.com
<tbody> </tbody>
std::bad_exception は以下の状況で C++ ランタイムによって投げられる例外の型です。
|
(C++11以上) |
|
(C++17未満) |
継承図
メンバ関数
bad_exception オブジェクトを構築します (パブリックメンバ関数) | |
| オブジェクトをコピーします (パブリックメンバ関数) | |
| 説明文字列を返します (仮想パブリックメンバ関数) |
例
#include <iostream> #include <exception> #include <stdexcept> void my_unexp() { throw; } void test() throw(std::bad_exception) { throw std::runtime_error("test"); } int main() { std::set_unexpected(my_unexp); try { test(); } catch(const std::bad_exception& e) { std::cerr << "Caught " << e.what() << '\n'; } }
出力例:
Caught std::bad_exception