std::future::wait - cppreference.com (original) (raw)

| void wait() const; | | (since C++11) | | ------------------ | | ------------- |

Blocks until the result becomes available. valid() == true after the call.

The behavior is undefined if valid() == false before the call to this function.

[edit] Parameters

(none)

[edit] Return value

(none)

[edit] Exceptions

May throw implementation-defined exceptions.

[edit] Notes

The implementations are encouraged to detect the case when valid() == false before the call and throw a std::future_error with an error condition of std::future_errc::no_state.

[edit] Example

Possible output:

waiting... 1.61803 seconds f1: 102334155 f2: 433494437

[edit] See also

| | waits for the result, returns if it is not available for the specified timeout duration (public member function) [edit] | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | waits for the result, returns if it is not available until specified time point has been reached (public member function) [edit] |