std::shared_future::get(3)
π std::shared_future::get(3) π
okay bestie, this page is straight out of the C++ Standard Libary manual, and it is literally all about std::shared_future::get β yes, the (3) is right there, iconic.
π NAME
std::shared_future::get β std::shared_future::get
π¦ Synopsis
Main template
const T& get() const; (1) (since C++11)
std::shared_future<T&> specializations
T& get() const; (2) (since C++11)
std::shared_future<void> specialization
void get() const; (3) (since C++11)
The get member function waits β by calling wait() β until the shared state is ready, and then it retrieves the value stored in the shared state (if any). π
If valid() is false before the call to this function, the behavior is undefined. not cute, not safe, just undefined π
π Return value
- A
constreference to the value stored in the shared state. The behavior of accessing the value through this reference after the shared state has been destroyed is undefined. - The reference stored as
valuein the shared state. - (none)
π¨ Exceptions
If an exception was stored in the shared state referenced by the future (e.g. via a call to std::promise::set_exception()) then that exception will be thrown.
π Notes
The C++ standard recommends the implementations to detect the case when valid() is false before the call and throw a std::future_error with an error condition of std::future_errc::no_state.
π§ͺ Example
This section is incomplete.
Reason: no example.
π See also
validβ checks if the future has a shared state (public member function)
π·οΈ Category
- Todo no example
source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::shared_future::get(3) β ty for reading bestie π«Άπ
π¦ 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