std::promise::get_future(3)
π NAME π
std::promise::get_future - std::promise::get_future
Okay bestie, welcome to std::promise::get_future(3) from the C++ Standard Libary manual. Yes, the page name is the name twice β self-titled queen behavior, periodt. This is the one about grabbing a future thatβs associated with the same shared state as *this. Obsessed. π¦
β¨ Synopsis β¨
std::future<R> get_future(); (since C++11)
Returns a future object associated with the same shared state as *this. Literally the whole vibe.
An exception is thrown if *this has no shared state or if get_future has already been called. So donβt try to double-dip, bestie. To get multiple "pop" ends of the promise-future communication channel, use std::future::share. πΈ
Calling this function does not introduce data races with calls to set_value, set_exception, set_value_at_thread_exit, or set_exception_at_thread_exit (therefore they need not synchronize with each other). No cap β thatβs the rule. π₯
π Parameters π
None. Literally none. No parameters, no stress, no extra arguments to babysit. π
π Return value π
A future referring to the shared state of *this. Thatβs it, thatβs the return. π
π Exceptions π
std::future_error on the following conditions:
*thishas no shared state. The error code is set tono_state.get_future()has already been called on a promise with the same shared state as*this. The error code is set tofuture_already_retrieved.
Catch you later β this pageβs source/version is http://cppreference.com, dated 2024.06.10 πβ¨
π¦ 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