std::tx_exception(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’… std::tx_exception πŸ’…

Okay bestie, welcome to the std::tx_exception(3) page from the C++ Standard Libary manual β€” yes, the header literally spells it Libary, and we’re keeping that detail because details are sacred πŸ’–.


✨ NAME ✨

std::tx_exception β€” and the name is literally std::tx_exception, no cap, that’s the whole vibe.

πŸ¦‹ Synopsis πŸ¦‹

Defined in header <stdexcept> πŸ‘‘

template< class T >
class tx_exception : public std::runtime_error;

(TM TS)

This defines an exception type that can be used to cancel and roll back an atomic transaction initiated by the keyword atomic_cancel β€” it’s giving very much β€œtransaction-safe icon” energy fr fr πŸ”₯.

If T is not TriviallyCopyable, the program that specializes std::tx_exception<T> is ill-formed. That’s a hard no, bestie πŸ™ˆ.


πŸŽ€ Member functions πŸŽ€

πŸ’« 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) Constructs the exception object with what_arg as the explanatory string that can be accessed through what() and value as the object that can be accessed through get().

4) Copy constructor. If *this and other both have dynamic type std::tx_exception<T> then std::strcmp(what(), other.what()) == 0.

🌸 Parameters 🌸

  • value β€” payload object
  • what_arg β€” explanatory string
  • other β€” another exception object to copy

πŸ’€ Exceptions πŸ’€

1-3) May throw implementation-defined exceptions.

πŸ‘‘ std::tx_exception::operator= πŸ‘‘

tx_exception& operator=( const tx_exception& other ) transaction_safe noexcept;

(TM TS)

Assigns the contents with those of other. If *this and other both have dynamic type std::tx_exception<T> then std::strcmp(what(), other.what()) == 0 after assignment.

🌸 Parameters 🌸

  • other β€” another exception object to assign with

⭐ Return value ⭐

*this

🧚 std::tx_exception::get 🧚

T get() const transaction_safe;  (TM TS)

Returns the payload object held by the exception object.

πŸ’€ Exceptions πŸ’€

May throw implementation-defined exceptions.

🌈 std::tx_exception::what 🌈

virtual const char* what() const transaction_safe_dynamic noexcept; (TM TS)

Returns the explanatory string.

🌸 Parameters 🌸

(none)

⭐ Return value ⭐

Pointer to a null-terminated string with explanatory information.


🫢 Inherited from std::runtime_error 🫢

Yep, it’s in the std::runtime_error family tree β€” that’s the whole note, bestie, no invented lore πŸ’œ.

✨ Inherited from std::exception ✨

πŸŽ€ Member functions πŸŽ€

  • destructor β€” destroys the exception object; [virtual] (virtual public member function of std::exception)
  • what β€” returns an explanatory string; [virtual] (virtual public member function of std::exception)

mwah πŸ’‹ source/version: http://cppreference.com Β· date: 2024.06.10 Β· page: std::tx_exception(3) β€” that’s the sign-off, periodt πŸ«ΆπŸ’–

πŸ“¦ where this page comes from