共用方式為


<exception>

定義數個與例外狀況處理有關的類型和函式。 在系統可從錯誤復原的情況下,使用例外狀況處理。 它提供方式,將控制從函式傳回至程式。 併入例外狀況處理的目標是增加程式穩定性,同時以有次序的方式從錯誤復原。

#include <exception>

Typedef

exception_ptr

描述例外狀況指標的類型。

terminate_handler

類型,描述適合做為 terminate_handler 之函式的指標。

unexpected_handler

類型,描述適合做為 unexpected_handler 之函式的指標。

函式

current_exception

取得目前例外狀況的指標。

get_terminate

取得目前的 terminate_handler 函式。

get_unexpected

取得目前的 unexpected_handler 函式。

make_exception_ptr

建立持有例外狀況複本的 exception_ptr 物件。

rethrow_exception

擲回做為參數傳遞的例外狀況。

set_terminate

建立新 terminate_handler,在程式終止時呼叫。

set_unexpected

建立新的 unexpected_handler,當未預期的例外狀況發生時擲回。

terminate

呼叫終止處理常式。

uncaught_exception

只有在擲回的例外狀況正在處理時,才傳回 true

unexpected

呼叫未預期的處理常式。

類別

bad_exception 類別

此類別描述從 unexpected_handler 所擲回的例外狀況。

exception 類別

此類別做為由某些運算式和 Standard C++ 程式庫所擲回的所有例外狀況的基底類別。

請參閱

參考

C++ 標準程式庫中的執行緒安全

其他資源

<exception> 成員

C++ 標準程式庫標頭檔