##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::tx_exception

From cppreference.com
< cpp‎ | error

Defined in header `<stdexcept>` |  |
template< class T > class tx_exception : public std::runtime_error; |  | (TM TS)

Defines an exception type that can be used to cancel and roll back an atomic transaction initiated by the keyword `atomic_cancel`

If `T` is not `TriviallyCopyable`, the program that specializes `std::tx_exception<T>` is ill-formed.

### [edit] Member functions

## std::tx_exception::tx_exception

explicit tx_exception( T value ) transaction_safe; | (1) |
tx_exception( T value, const std::string& what_arg ) transaction_safe; | (2) |
tx_exception( T value, const char* what_arg ) transaction_safe; | (3) |

Constructs the exception object with `what_arg` as explanatory string that can be accessed through what() and `value` as the object that can be accessed through get().

### Parameters

value | - | payload object
what_arg | - | explanatory string

### Exceptions

(none)

## std::tx_exception::get

T get() const transaction_safe; |  |

Returns the payload object object held by the exception object.

### Exceptions

(none)

## Inherited from std::runtime_error

## Inherited from std::exception

### Member functions

(destructor) [virtual] | destructs the exception object (virtual public member function of `std::exception`) [edit]
what [virtual] | returns an explanatory string (virtual public member function of `std::exception`) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/error/tx_exception&oldid=85818"