std::tx_exception
来自cppreference.com
在标头 <stdexcept> 定义 | ||
template<class T > class tx_exception :publicstd::runtime_error; | (TM TS) | |
定义能用于取消并回滚关键词 atomic_cancel 所初始化的原子事务的异常类型。
若 T
非可平凡复制(TriviallyCopyable) ,则特化 std::tx_exception<T>
的程序非良构。
目录 |
[编辑]成员函数
std::tx_exception::tx_exception
explicit tx_exception( T value ) transaction_safe; | (1) | (TM TS) |
tx_exception( T value, conststd::string& what_arg ) transaction_safe; | (2) | (TM TS) |
tx_exception( T value, constchar* 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() 访问的对象构造异常对象。
参数
value | - | 载荷对象 |
what_arg | - | 解释字符串 |
other | - | 要复制的另一字符串 |
异常
1-3) 可能抛出由实现定义的异常。
std::tx_exception::operator=
tx_exception& operator=(const tx_exception& other ) transaction_safe noexcept; | (TM TS) | |
以 other 的内容赋值其内容。若 *this 与 other 均拥有动态类型 std::tx_exception<T>
则赋值后 std::strcmp(what(), other.what())==0。
参数
other | - | 用以赋值的另一异常对象 |
返回值
*this
std::tx_exception::get
T get()const transaction_safe; | (TM TS) | |
返回异常对象保有的载荷对象。
异常
可能抛出由实现定义的异常。
std::tx_exception::what
virtualconstchar* what()const transaction_safe_dynamic noexcept; | (TM TS) | |
返回解释字符串。
参数
(无)
返回值
指向拥有解释信息的空中止字符串的指针。