Variadic Futures
Public Types | Public Member Functions | List of all members
aom::Basic_future< Alloc, Ts > Class Template Reference

Values that will be eventually available. More...

#include <future.h>

Public Types

using promise_type = Basic_promise< Alloc, Ts... >
 
using storage_type = detail::Future_storage< Alloc, Ts... >
 The underlying storage type.
 
using allocator_type = Alloc
 Allocator.
 
using value_type = detail::future_value_type_t< Ts... >
 Ts...
 
using fullfill_type = detail::fullfill_type_t< Ts... >
 
using finish_type = detail::finish_type_t< Ts... >
 

Public Member Functions

 Basic_future ()=default
 Construct an uninitialized Future. More...
 
 Basic_future (Basic_future &&rhs)=default
 Move constructor. More...
 
Basic_futureoperator= (Basic_future &&rhs)=default
 Move assignment. More...
 
template<typename CbT >
auto then (CbT &&callback)
 Creates a future that is finished by the invocation of cb when this is fullfilled. More...
 
template<typename QueueT , typename CbT >
auto then (QueueT &queue, CbT &&callback)
 Creates a future that is finished by the invocation of cb when this is finished. More...
 
template<typename CbT >
auto then_expect (CbT &&callback)
 Creates a future that is finished by the invocation of cb when this is finished. More...
 
template<typename QueueT , typename CbT >
auto then_expect (QueueT &queue, CbT &&callback)
 Creates a future that is finished by the invocation of cb from queue when this is finished. More...
 
template<typename CbT >
void finally (CbT &&callback)
 Invokes cb when this is finished. More...
 
template<typename QueueT , typename CbT >
void finally (QueueT &queue, CbT &&callback)
 Invokes cb from queue when this is finished. More...
 
value_type get ()
 Blocks until the future is finished, and then either return the value, or throw the error. More...
 
auto std_future ()
 Obtain a std::future bound to this future. More...
 
allocator_typeallocator ()
 Get the allocator associated with this future. More...
 
 Basic_future (detail::Storage_ptr< storage_type > s)
 Create a future directly from its underlying storage.
 

Detailed Description

template<typename Alloc, typename... Ts>
class aom::Basic_future< Alloc, Ts >

Values that will be eventually available.

Template Parameters
Tsfields set to void have special rules applied to them. The following types may not be used:
  • expected<T>
  • Future<Ts...>
  • Promise<T>
Invariant
A Future is in one of two states:
  • Uninitialized: The only legal operation is to assign another future to it.
  • Ready: All operations are legal.

Constructor & Destructor Documentation

◆ Basic_future() [1/2]

template<typename Alloc, typename... Ts>
aom::Basic_future< Alloc, Ts >::Basic_future ( )
default

Construct an uninitialized Future.

Postcondition
this will be uninitialized

◆ Basic_future() [2/2]

template<typename Alloc, typename... Ts>
aom::Basic_future< Alloc, Ts >::Basic_future ( Basic_future< Alloc, Ts > &&  rhs)
default

Move constructor.

Parameters
rhs
Postcondition
rhs will be uninitialized

Member Function Documentation

◆ allocator()

template<typename Alloc, typename... Ts>
allocator_type& aom::Basic_future< Alloc, Ts >::allocator ( )

Get the allocator associated with this future.

Precondition
The future must have shared storage associated with it.
Returns
Alloc&

◆ finally() [1/2]

template<typename Alloc, typename... Ts>
template<typename CbT >
void aom::Basic_future< Alloc, Ts >::finally ( CbT &&  callback)

Invokes cb when this is finished.

Template Parameters
CbT
Parameters
callback
Precondition
the future must be ready
Postcondition
the future will be uninitialized

◆ finally() [2/2]

template<typename Alloc, typename... Ts>
template<typename QueueT , typename CbT >
void aom::Basic_future< Alloc, Ts >::finally ( QueueT &  queue,
CbT &&  callback 
)

Invokes cb from queue when this is finished.

Template Parameters
QueueT
CbT
Parameters
queue
callback
Precondition
the future must be ready
Postcondition
the future will be uninitialized

◆ get()

template<typename Alloc, typename... Ts>
value_type aom::Basic_future< Alloc, Ts >::get ( )

Blocks until the future is finished, and then either return the value, or throw the error.

Returns
auto
Precondition
the future must be ready
Postcondition
the future will be uninitialized

◆ operator=()

template<typename Alloc, typename... Ts>
Basic_future& aom::Basic_future< Alloc, Ts >::operator= ( Basic_future< Alloc, Ts > &&  rhs)
default

Move assignment.

Parameters
rhs
Returns
Future&
Postcondition
rhs will be uninitialized

◆ std_future()

template<typename Alloc, typename... Ts>
auto aom::Basic_future< Alloc, Ts >::std_future ( )

Obtain a std::future bound to this future.

Returns
auto

◆ then() [1/2]

template<typename Alloc, typename... Ts>
template<typename CbT >
auto aom::Basic_future< Alloc, Ts >::then ( CbT &&  callback)

Creates a future that is finished by the invocation of cb when this is fullfilled.

Template Parameters
CbT
Parameters
callback
Returns
Future<decltype(callback(Ts...))> a \ready Future
Precondition
the future must be ready
Postcondition
the future will be uninitialized

◆ then() [2/2]

template<typename Alloc, typename... Ts>
template<typename QueueT , typename CbT >
auto aom::Basic_future< Alloc, Ts >::then ( QueueT &  queue,
CbT &&  callback 
)

Creates a future that is finished by the invocation of cb when this is finished.

Template Parameters
QueueT
CbT
Parameters
queue
callback
Returns
auto
Precondition
the future must be ready
Postcondition
the future will be uninitialized

◆ then_expect() [1/2]

template<typename Alloc, typename... Ts>
template<typename CbT >
auto aom::Basic_future< Alloc, Ts >::then_expect ( CbT &&  callback)

Creates a future that is finished by the invocation of cb when this is finished.

Template Parameters
CbT
Parameters
callback
Returns
auto
Precondition
the future must be ready
Postcondition
the future will be uninitialized

◆ then_expect() [2/2]

template<typename Alloc, typename... Ts>
template<typename QueueT , typename CbT >
auto aom::Basic_future< Alloc, Ts >::then_expect ( QueueT &  queue,
CbT &&  callback 
)

Creates a future that is finished by the invocation of cb from queue when this is finished.

Template Parameters
QueueT
CbT
Parameters
queue
callback
Returns
auto
Precondition
the future must be ready
Postcondition
the future will be uninitialized

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