std::make_exception_ptr

From cppreference.com
< cpp‎ | error
 
 
Utilities library
Type support (basic types, RTTI, type traits)
Dynamic memory management
Error handling
Program utilities
Variadic functions
Date and time
Function objects
(C++11)
Relational operators
Optional and any
(C++17)
(C++17)
Pairs and tuples
(C++11)
(C++17)
Swap, forward and move
(C++14)
(C++11)
(C++11)
Type operations
(C++11)
(C++17)
 
Error handling
Exception handling
(C++11)
make_exception_ptr
(C++11)
(C++17)
Exception handling failures
(C++11)
(deprecated)
(deprecated)
(C++11)(deprecated)
(deprecated)
 
Defined in header <exception>
template< class E >
std::exception_ptr make_exception_ptr( E e );
(since C++11)

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

(none)

[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] Exceptions

noexcept specification:  
noexcept
  

[edit] Notes

The parameter is passed by value and is subject to slicing.

[edit] See also

captures the current exception in a std::exception_ptr
(function)