std::exception_ptr(3cxx)
πΈ std::exception_ptr πΈ
hey bestie π welcome to the 3cxx section of the libstdc++ manuals β this is the page for std::exception_ptr, and honestly? it's giving "small but mighty." let's get into it π¦
β¨ NAME β¨
std::exception_ptr β an opaque pointer to an arbitrary exception. that's it. that's the whole vibe. π
π SYNOPSIS π
first things first, you gotta pull in the header:
#include <exception>
π Public Member Functions π
exception_ptr (const exception_ptr &) noexceptβ copy constructor,noexcept, so it will never throw at you. slay.exception_ptr (exception_ptr &&__o) noexceptβ move constructor, alsonoexcept, takes the__orvalue reference and does its little move thing. β¨exception_ptr (nullptr_t) noexceptβ construct one fromnullptr_t. yes,noexcepttoo. πconst class std::type_info * __cxa_exception_type () const noexceptβ hands you back aconst class std::type_info *. it'sconstandnoexcept, so it's the chill, well-behaved one of the group. πoperator bool () const noexceptβ lets you use anexception_ptrin a boolean context,constandnoexcept. vibe check built right in. βexception_ptr & operator= (const exception_ptr &) noexceptβ copy assignment,noexcept, returns a reference to theexception_ptr. πexception_ptr & operator= (exception_ptr &&__o) noexceptβ move assignment,noexcept, takes__oand returns a reference. π§void swap (exception_ptr &) noexceptβ swaps with anotherexception_ptr &, returnsvoid, and yep,noexcept. iconic behavior. π
π«Ά Friends π«Ά
these are the friend functions, aka the inner circle:
bool operator== (const exception_ptr &, const exception_ptr &)β takes twoconst exception_ptr &and gives you back abool. it's markednoexcept=default. π₯exception_ptr std::current_exception () noexceptβ returns anexception_ptrand isnoexcept. main character energy, fr fr.template<typename _Ex> exception_ptr std::make_exception_ptr (_Ex) noexceptβ a template over_Exthat hands you anexception_ptr, and it'snoexcept. β¨void std::rethrow_exception (exception_ptr)β returnsvoid, takes anexception_ptr. π (yes bestie, it does what the name says)void swap (exception_ptr &__lhs, exception_ptr &__rhs)β the free-function swap. returnsvoid, takes__lhsand__rhs, bothexception_ptr &. πΈ
π Related Symbols π
heads up bestie: these are not member symbols. i repeat β not member symbols.
void swap (exception_ptr &__lhs, exception_ptr &__rhs)β yeah it's listed here too. same signature, same energy. it's just also living in the related-symbols neighborhood. no cap. π
π Detailed Description π
okay so here's the tea π:
an opaque pointer to an arbitrary exception.
the actual name of this type is unspecified, so the alias std::exception_ptr should be used to refer to it. iykyk β don't go trying to name the type yourself, just use the alias, bestie. π¦
π°οΈ Since π°οΈ
C++11(but usable inC++98as a GCC extension) π
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. (not a human girlie writing this, a whole tool. respect. π)
and that's the page, bestie!! π this was the 3cxx manual, brought to you by libstdc++ β mwah, go forth and catch those exceptions responsibly π«Άβ¨π
π¦ where this page comes from
- ubuntu resolute: libstdc++-16-doc 16-20260322-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms