std::bad_exception
提供: cppreference.com
<tbody>
</tbody>

| ヘッダ <exception> で定義
|
||
class bad_exception; |
||
std::bad_exception は以下の状況で C++ ランタイムによって投げられる例外の型です。
|
(C++11以上) |
|
(C++17未満) |
継承図
メンバ関数
bad_exception オブジェクトを構築します (パブリックメンバ関数) | |
| オブジェクトをコピーします (パブリックメンバ関数) | |
[仮想] |
説明文字列を返します (仮想パブリックメンバ関数) |
std::exception から継承
メンバ関数
[仮想] |
例外オブジェクトを破棄します ( std::exceptionの仮想パブリックメンバ関数)
|
[仮想] |
説明文字列を返します ( std::exceptionの仮想パブリックメンバ関数)
|
例
Run this code
#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