A one-to-one provider for a single value.
An ValueProvider can only vend one ValueFuture at a time.
This provider is multi-shot: after Resolve is called, a new future can be retrieved with Get to wait for the next Resolve event.
Public Member Functions | |
| ValueFuture< T > | Get () |
| std::optional< ValueFuture< T > > | TryGet () |
| bool | has_future () |
Returns true if the provider stores a pending future. | |
| template<typename... Args, typename U = T, std::enable_if_t<!std::is_void_v< U >, int > = 0> | |
| void | Resolve (Args &&... args) |
Resolves the pending ValueFuture by constructing its value in-place. | |
| template<typename U = T, std::enable_if_t< std::is_void_v< U >, int > = 0> | |
| void | Resolve () |
Resolves the pending ValueFuture. | |
|
inline |
Returns a ValueFuture that will be completed when Resolve is called.
If a future has already been vended and is still pending, this crashes.
|
inline |
Returns a ValueFuture that will be completed when Resolve is called.
If a future has already been vended and is still pending, this will return std::nullopt.