std::tx_exception
来自cppreference.com
| 定义于头文件 <stdexcept>
|
||
| template< class T > class tx_exception : public std::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, 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() 访问的对象构造异常对象。参数
| 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
| virtual const char* what() const transaction_safe_dynamic noexcept; |
(TM TS) | |
返回解释字符串。
参数
(无)
返回值
指向拥有解释信息的空中止字符串的指针。
继承自 std::exception
成员函数
| [虚] |
析构该异常对象 ( std::exception 的虚公开成员函数) |
| [虚] |
返回解释性字符串 ( std::exception 的虚公开成员函数) |