std::make_exception_ptr
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Diagnostics library
(until C++20*)
(C++17)(C++11)
make_exception_ptr
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Exception handling failures
(C++11)
(until C++17*)
(until C++17*)
(until C++17*)
(until C++17*)
(TM TS)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++23)
(C++23)
(C++26)
(C++26)
(C++26)
Defined in header
<exception>
template< class E >
std::exception_ptr make_exception_ptr( E e ) noexcept;
(since C++11) std::exception_ptr make_exception_ptr( E e ) noexcept;
(constexpr since C++26)
Creates an std::exception_ptr that holds a reference to a copy of e. This is done as if executing the following code:
try { throw e; } catch(...) { return std::current_exception (); }
Contents
[edit] Parameters
e
-
exception object to create a reference to the copy of
[edit] 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 ).
[edit] Notes
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 |
[edit] Example
This section is incomplete
Reason: no example
Reason: no example