std::make_exception_ptr(3)

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

πŸ’– NAME πŸ’–

Okay bestie, welcome to the std::make_exception_ptr(3) page from the C++ Standard Libary manual πŸ’…. The name on the tin is literally:

std::make_exception_ptr β€” std::make_exception_ptr


✨ Synopsis ✨

Defined in header <exception>

template< class E >                                     (since C++11)
std::exception_ptr make_exception_ptr( E e ) noexcept;

So this one creates an std::exception_ptr that holds a reference to a copy of e πŸ‘‘. It does that as if this code was executing:

try {
    throw e;
} catch(...) {
    return std::current_exception();
}

🌸 Parameters 🌸

Literally none: (none) 🫢.


πŸ¦‹ Return value πŸ¦‹

An instance of std::exception_ptr holding a reference to the copy of e, or to an instance of std::bad_alloc or to an instance of std::bad_exception (see std::current_exception) ✨.


πŸŽ€ Notes πŸŽ€

The parameter is passed by value and is subject to slicing πŸ‘€. That’s the note, bestie β€” slicing is the vibe check it can fail, so keep it in mind πŸ’….


🌈 See also 🌈

  • current_exception β€” captures the current exception in a std::exception_ptr (C++11) (function)

Source/version/date: http://cppreference.com β€’ 2024.06.10 β€’ std::make_exception_ptr(3) β€” bye bestie, slay your exceptions πŸ’–βœ¨

πŸ“¦ where this page comes from