名稱空間
變體
操作

std::set_unexpected

來自 cppreference.com
< cpp‎ | 錯誤
定義於標頭檔案 <exception>
(C++11 前)
std::unexpected_handler set_unexpected( std::unexpected_handler f ) noexcept;
(C++11中已棄用)
(在 C++17 中已移除)

f 設定為新的全域性 std::unexpected_handler 並返回先前安裝的 std::unexpected_handler

此函式是執行緒安全的。每次呼叫 std::set_unexpected 都會與(見 std::memory_order)後續對 std::set_unexpectedstd::get_unexpected 的呼叫進行 *同步*。

(C++11 起)

[編輯] 引數

f - 指向型別為 std::unexpected_handler 的函式的指標,或空指標。

[編輯] 返回值

先前安裝的意外處理程式,如果未安裝則為 null 指標值。

[編輯] 參閱

(C++11 中已廢棄)(C++17 中已移除)
動態異常規範被違反時呼叫的函式
(函式) [編輯]
(C++11 中已廢棄)(C++17 中已移除)
獲取當前的 unexpected_handler
(函式) [編輯]
(C++11 中已廢棄)(C++17 中已移除)
std::unexpected 呼叫的函式型別
(型別定義) [編輯]