std::experi...onal_future(3)
π std::experimental::make_exceptional_future π
okay so bestie, this one's from the C++ Standard Library manual (yes, the cppreference one, we stan β¨) and the NAME is literally std::experimental::make_exceptional_future β that's the function, that's the whole vibe, no notes π
β¨ SYNOPSIS β¨
Defined in header <experimental/future>
template< class T > (1)
(concurrency TS)
future<T> make_exceptional_future( std::exception_ptr ex );
template< class T, class E > (2)
(concurrency TS)
future<T> make_exceptional_future( E ex );
so there's two overloads and both of them live in the concurrency TS, iykyk π¦
- Overload (1) β makes a shared state of type
Tthat's immediately ready and stores the exception pointerexinside it, then hands you back afutureassociated with that shared state, as if by:
promise<T> p; p.set_exception(ex); return p.get_future();
β οΈ lowkey important: the behavior is undefined if ex is null. like, undefined undefined. don't do it π
- Overload (2) β makes a shared state of type
Tthat's immediately ready and stores an exception pointer created fromex, then returns afutureassociated with that shared state, as if by:
promise<T> p;
p.set_exception(std::make_exception_ptr(ex)); return
p.get_future();
same immediate-ready energy, just built from ex instead of a raw std::exception_ptr, periodt π
π RETURN VALUE π
a future object all cozy and associated with the shared state that was just created. that's it. that's the return. she's ready instantly πΈ
π SEE ALSO π
make_ready_futureβ produces a future that is ready immediately and holds the given value (this one's also part of the concurrency TS), and it's a function template π«Ά
so yeah, that's the whole page, no cap. and before you go β this lil beauty is served fresh from http://cppreference.com, dated 2024.06.10, under the std::experi...onal_future(3) banner. go make some exceptional futures bestie, you got this ππ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms