WPILibC++ 2023.4.3
wpi::future< void > Class Referencefinal

Explicit specialization for future<void>. More...

#include <wpi/future.h>

Public Member Functions

 future () noexcept=default
 Constructs an empty (invalid) future. More...
 
 future (future &&oth) noexcept
 
 future (const future &)=delete
 
 ~future ()
 Ignores the result of the future if it has not been retrieved. More...
 
futureoperator= (future &&oth) noexcept
 
futureoperator= (const future &)=delete
 
void get ()
 Gets the value. More...
 
template<typename R , typename F >
future< R > then (PromiseFactory< R > &factory, F &&func)
 
template<typename F , typename R = typename std::invoke_result_t<F&&>>
future< R > then (F &&func)
 
bool is_ready () const noexcept
 
bool valid () const noexcept
 Checks if the future is valid. More...
 
void wait () const
 Waits for the promise to provide a value. More...
 
template<class Clock , class Duration >
bool wait_until (const std::chrono::time_point< Clock, Duration > &timeout_time) const
 Waits for the promise to provide a value, or the specified time has been reached. More...
 
template<class Rep , class Period >
bool wait_for (const std::chrono::duration< Rep, Period > &timeout_duration) const
 Waits for the promise to provide a value, or the specified amount of time has elapsed. More...
 

Friends

class PromiseFactory< void >
 
class promise< void >
 

Detailed Description

Explicit specialization for future<void>.

Constructor & Destructor Documentation

◆ future() [1/3]

wpi::future< void >::future ( )
defaultnoexcept

Constructs an empty (invalid) future.

◆ future() [2/3]

wpi::future< void >::future ( future< void > &&  oth)
inlinenoexcept

◆ future() [3/3]

wpi::future< void >::future ( const future< void > &  )
delete

◆ ~future()

wpi::future< void >::~future ( )
inline

Ignores the result of the future if it has not been retrieved.

Member Function Documentation

◆ get()

void wpi::future< void >::get ( )
inline

Gets the value.

Calls wait() if the value is not yet available. Can only be called once. The future will be marked invalid after the call.

◆ is_ready()

bool wpi::future< void >::is_ready ( ) const
inlinenoexcept

◆ operator=() [1/2]

future & wpi::future< void >::operator= ( const future< void > &  )
delete

◆ operator=() [2/2]

future & wpi::future< void >::operator= ( future< void > &&  oth)
inlinenoexcept

◆ then() [1/2]

template<typename F , typename R = typename std::invoke_result_t<F&&>>
future< R > wpi::future< void >::then ( F &&  func)
inline

◆ then() [2/2]

template<typename R , typename F >
future< R > wpi::future< void >::then ( PromiseFactory< R > &  factory,
F &&  func 
)
inline

◆ valid()

bool wpi::future< void >::valid ( ) const
inlinenoexcept

Checks if the future is valid.

A default-constructed future or one where get() has been called is invalid.

Returns
True if valid

◆ wait()

void wpi::future< void >::wait ( ) const
inline

Waits for the promise to provide a value.

Does not return until the value is available or the promise is destroyed If the value has already been provided, returns immediately.

◆ wait_for()

template<class Rep , class Period >
bool wpi::future< void >::wait_for ( const std::chrono::duration< Rep, Period > &  timeout_duration) const
inline

Waits for the promise to provide a value, or the specified amount of time has elapsed.

Returns
True if the promise provided a value, false if timed out.

◆ wait_until()

template<class Clock , class Duration >
bool wpi::future< void >::wait_until ( const std::chrono::time_point< Clock, Duration > &  timeout_time) const
inline

Waits for the promise to provide a value, or the specified time has been reached.

Returns
True if the promise provided a value, false if timed out.

Friends And Related Function Documentation

◆ promise< void >

friend class promise< void >
friend

◆ PromiseFactory< void >

friend class PromiseFactory< void >
friend

The documentation for this class was generated from the following file: