WPILibC++  2019.3.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
wpi::promise< T > Class Template Reference

A lightweight version of std::promise. More...

#include <future.h>

Public Member Functions

 promise ()
 Constructs an empty promise.
 
 promise (promise &&oth) noexcept
 
 promise (const promise &)=delete
 
 ~promise ()
 Sets the promised value to a default-constructed T if not already set.
 
promiseoperator= (promise &&oth) noexcept
 
promiseoperator= (const promise &)=delete
 
void swap (promise &oth) noexcept
 Swaps this promise with another one.
 
future< T > get_future () noexcept
 Gets a future for this promise. More...
 
void set_value (const T &value)
 Sets the promised value. More...
 
void set_value (T &&value)
 Sets the promised value. More...
 

Friends

class PromiseFactory< T >
 

Detailed Description

template<typename T>
class wpi::promise< T >

A lightweight version of std::promise.

Use PromiseFactory::CreatePromise() to create.

Template Parameters
Tthe "return" type

Member Function Documentation

template<typename T>
future<T> wpi::promise< T >::get_future ( )
inlinenoexcept

Gets a future for this promise.

Returns
The future
template<typename T>
void wpi::promise< T >::set_value ( const T &  value)
inline

Sets the promised value.

Only effective once (subsequent calls will be ignored).

Parameters
valueThe value to provide to the waiting future
template<typename T>
void wpi::promise< T >::set_value ( T &&  value)
inline

Sets the promised value.

Only effective once (subsequent calls will be ignored).

Parameters
valueThe value to provide to the waiting future

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