命名空间
变体
操作

std::tx_exception

来自 cppreference.cn
< 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 的虚公共成员函数) [编辑]