std::experimental::make_exceptional_future
From cppreference.com
 
 
 < cpp | experimental 
 
 
 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)
Experimental 
 Filesystem library (filesystem TS)
 Library fundamentals (library fundamentals TS)
 Library fundamentals 2 (library fundamentals TS v2)
 Library fundamentals 3 (library fundamentals TS v3)
 Extensions for parallelism (parallelism TS)
 Extensions for parallelism 2 (parallelism TS v2)
 Extensions for concurrency (concurrency TS)
 Extensions for concurrency 2 (concurrency TS v2)
 Concepts (concepts TS)
 Ranges (ranges TS)
 Reflection (reflection TS)
 Mathematical special functions (special functions TR)
Extensions for concurrency 
 
 std::future extensions
experimental::make_exceptional_future
 Latches and barriers
 Atomic smart pointers
Defined in header 
 
 
<experimental/future> 
 template< class T >
future<T> make_exceptional_future( std::exception_ptr ex );
 (1) 
 (concurrency TS) 
future<T> make_exceptional_future( std::exception_ptr ex );
template< class T, class E >
future<T> make_exceptional_future( E ex );
 (2) 
 (concurrency TS) 
future<T> make_exceptional_future( E ex );
1) Creates a shared state of type 
T that is immediately ready and stores the exception pointer ex, then return a future associated with that shared state, as if by promise<T> p; p.set_exception(ex); return p.get_future();. The behavior is undefined if ex is null.2) Creates a shared state of type 
T that is immediately ready and stores an exception pointer created from ex, then return a future associated with that shared state, as if by promise<T> p; p.set_exception(std::make_exception_ptr (ex)); return p.get_future();.[edit] Return value
A future object associated with the shared state that was created.
[edit] See also
(concurrency TS)
(function template) [edit]