|
|
Defined in header <exception> | ||
template<class E> std::exception_ptr make_exception_ptr( E e)noexcept; | (since C++11) (constexpr since C++26) | |
Creates anstd::exception_ptr that holds a reference to a copy ofe. This is done as if executing the following code:
try{throw e;}catch(...){returnstd::current_exception();}
Contents |
e | - | exception object to create a reference to the copy of |
An instance ofstd::exception_ptr holding a reference to the copy ofe, or to an instance ofstd::bad_alloc or to an instance ofstd::bad_exception (seestd::current_exception).
The parameter is passed by value and is subject to slicing.
Feature-test macro | Value | Std | Feature |
---|---|---|---|
__cpp_lib_constexpr_exceptions | 202411L | (C++26) | constexpr for exception types |
This section is incomplete Reason: no example |
(C++11) | captures the current exception in astd::exception_ptr (function)[edit] |