名稱空間
變體
操作

std::tx_exception

來自 cppreference.com
< cpp‎ | 錯誤
定義於標頭檔案 <stdexcept>
template< class T >
class tx_exception : public std::runtime_error;
(TM TS)

定義了一種異常型別,可用於取消和回滾由關鍵字 atomic_cancel 啟動的原子事務。

如果 `T` 不是 可平凡複製的(TriviallyCopyable),則特化 `std::tx_exception` 的程式格式錯誤。

目錄

[編輯] 成員函式

std::tx_exception::tx_exception

explicit tx_exception( T value ) transaction_safe;
(1) (TM TS)
tx_exception( T value, const std::string& what_arg ) transaction_safe;
(2) (TM TS)
tx_exception( T value, const char* what_arg ) transaction_safe;
(3) (TM TS)
tx_exception( const tx_exception& other ) transaction_safe noexcept;
(4) (TM TS)
1-3) 構造異常物件,以 what_arg 作為解釋性字串,可透過 what() 訪問;以 value 作為物件,可透過 get() 訪問。
4) 複製建構函式。如果 *thisother 都具有動態型別 `std::tx_exception`,則 std::strcmp(what(), other.what()) == 0

引數

- 負載物件
what_arg - 解釋性字串
其他 - 要複製的另一個異常物件

異常

1-3) 可能丟擲實現定義的異常。

std::tx_exception::operator=

tx_exception& operator=( const tx_exception& other ) transaction_safe noexcept;
(TM TS)

將內容賦值為 other 的內容。如果賦值後 *thisother 都具有動態型別 `std::tx_exception`,則 std::strcmp(what(), other.what()) == 0

引數

其他 - 用於賦值的另一個異常物件

返回值

*this

std::tx_exception::get

T get() const transaction_safe;
(TM TS)

返回異常物件持有的負載物件。

異常

可能丟擲實現定義的異常。

std::tx_exception::what

virtual const char* what() const transaction_safe_dynamic noexcept;
(TM TS)

返回解釋字串。

引數

(無)

返回值

指向以 null 結尾的字串的指標,包含解釋性資訊。

繼承自 std::runtime_error


繼承自 std::exception

成員函式

[虛擬函式]
銷燬異常物件
(std::exception 的虛公共成員函式) [編輯]
[虛擬函式]
返回解釋字串
(std::exception 的虛公共成員函式) [編輯]
English 日本語 中文(简体) 中文(繁體)