std::unexpected
提供: cppreference.com
ヘッダ <exception> で定義
|
||
void unexpected(); |
(C++11未満) | |
[[noreturn]] void unexpected(); |
(C++11以上) (非推奨) (C++17で削除) |
|
std::unexpected()
は、動的例外指定に違反したとき、つまり例外指定の禁止する例外が関数から投げられたときに、 C++ のランタイムによって呼ばれます。
std::unexpected()
はプログラムから直接呼ぶこともできます。
いずれの場合でも、 std::unexpected
は現在設定されている std::unexpected_handler を呼びます。 デフォルトの std::unexpected_handler は std::terminate を呼びます。
スタックの巻き戻し中にデストラクタが unexpected handler をリセットし、その巻き戻しが後に |
(C++11未満) |
ス���ックの巻き戻し中にデストラクタが unexpected handler をリセットし、その巻き戻しが後に |
(C++11以上) |
目次 |
[編集] 引数
(なし)
[編集] 戻り値
(なし)
[編集] 例外
現在設定されている std::unexpected_handler によって投げられるあらゆる例外を投げます。
[編集] 欠陥報告
以下の動作変更欠陥報告は以前に発行された C++ 標準に遡って適用されました。
DR | 適用先 | 発行時の動作 | 正しい動作 |
---|---|---|---|
LWG 2111 | C++11 | effect of calling set_unexpected during stack unwinding differs from C++98 and breaks some ABIs
|
made unspecified |
[編集] 関連項目
(C++17で削除) |
std::unexpected によって呼ばれる関数の型 (typedef) |