Namespaces
Variants

std:: tx_exception

From cppreference.net
定义于头文件 <stdexcept>
template < class T >
class tx_exception : public std:: runtime_error ;
(TM TS)

定义一种异常类型,可用于取消并回滚由关键字 atomic_cancel 启动的原子事务。

如果 T 不是 可平凡复制 类型,则特化 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() 访问的对象。
4) 拷贝构造函数。如果 * this other 都具有动态类型 std::tx_exception<T> ,则满足 std:: strcmp ( what ( ) , other. what ( ) ) == 0

参数

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

成员函数

[virtual]
销毁异常对象
( std::exception 的虚公开成员函数)
[virtual]
返回说明性字符串
( std::exception 的虚公开成员函数)