Implement ISO/IEC TS 19571:2016 future for void.
More...
#include <google/cloud/future_void.h>
|
| future () noexcept |
|
| future (future< future< void >> &&rhs) noexcept(false) |
| Creates a new future that unwraps rhs . More...
|
|
void | get () |
| Waits until the shared state becomes ready, then retrieves the value stored in the shared state. More...
|
|
template<typename F > |
internal::then_helper< F, void >::future_t | then (F &&func) |
| Attach a continuation to the future. More...
|
|
| future (std::shared_ptr< shared_state_type > state) |
|
|
template<typename U > |
class | future |
|
template<>
class google::cloud::v0::future< void >
Implement ISO/IEC TS 19571:2016 future for void.
Definition at line 35 of file future_void.h.
◆ shared_state_type
◆ future() [1/3]
◆ future() [2/3]
Creates a new future that unwraps rhs
.
This constructor creates a new shared state that becomes satisfied when both rhs
and rhs.get()
become satisfied. If rhs
is satisfied, but rhs.get()
returns an invalid future then the newly created future becomes satisfied with a std::future_error
exception, and the exception error code is std::future_errc::broken_promise
.
- Note
- The technical specification requires this to be a
noexcept
constructor I (coryan) believe this is a defect in the technical specification, as this creates a new shared state: shared states are dynamically allocated, and the allocator (which might be the default operator new
) may raise.
◆ future() [3/3]
◆ get()
Waits until the shared state becomes ready, then retrieves the value stored in the shared state.
- Exceptions
-
any | exceptions stored in the shared state. |
std::future_error | with std::no_state if the future does not have a shared state. |
Definition at line 69 of file future_void.h.
◆ then()
Attach a continuation to the future.
Attach a callable func to be invoked when the future is ready. The return type is a future wrapping the return type of func.
- Returns
- future<T> where T is std::result_of_t<F, R> (basically). If T matches future<U> then it returns future<U>. The returned future will contain the result of func.
- Parameters
-
func | a Callable to be invoked when the future is ready. The function might be called immediately, e.g., if the future is ready. |
Side effects: valid() == false if the operation is successful.
Definition at line 99 of file future_void.h.
◆ future