std::future< _Res > Class Template Reference
Concurrency » Futures

`#include <future>`

Inheritance diagram for std::future< _Res >:
[legend]

## Public Types

template<typename _Res >
using | _Ptr = unique_ptr< _Res, _Result_base::_Deleter >
using | _State_base = _State_baseV2

## Public Member Functions

| future (const future &)=delete
| future (future &&__uf) noexcept
_Res | get ()
future & | operator= (const future &)=delete
future & | operator= (future &&__fut) noexcept
shared_future< _Res > | share () noexcept
bool | valid () const noexcept
void | wait () const
template<typename _Rep , typename _Period >
future_status | wait_for (const chrono::duration< _Rep, _Period > &__rel) const
template<typename _Clock , typename _Duration >
future_status | wait_until (const chrono::time_point< _Clock, _Duration > &__abs) const

## Static Public Member Functions

template<typename _Res , typename _Allocator >
static _Ptr< _Result_alloc< _Res, _Allocator > > | _S_allocate_result (const _Allocator &__a)
template<typename _Res , typename _Tp >
static _Ptr< _Result< _Res > > | _S_allocate_result (const std::allocator< _Tp > &__a)
template<typename _Res_ptr , typename _BoundFn >
static _Task_setter< _Res_ptr, _BoundFn > | _S_task_setter (_Res_ptr &__ptr, _BoundFn &__call)

## Protected Types

typedef __future_base::_Result< _Res > & | __result_type

## Protected Member Functions

__result_type | _M_get_result () const
void | _M_swap (__basic_future &__that) noexcept

## Friends

template<typename _Fn , typename... _Args>
future< __async_result_of< _Fn, _Args... > > | async (launch, _Fn &&, _Args &&...)
template<typename >
class | packaged_task
class | promise< _Res >

## Detailed Description

template<typename _Res>
class std::future< _Res >

Primary template for future.

Definition at line 763 of file future.

## Member Typedef Documentation

## __result_type

template<typename _Res >

typedef __future_base::_Result<_Res>& std::__basic_future< _Res >::__result_type

protected inherited

Definition at line 677 of file future.

## _Ptr

template<typename _Res >

using std::__future_base::_Ptr = unique_ptr<_Res, _Result_base::_Deleter>

inherited

A unique_ptr for result objects.

Definition at line 222 of file future.

## _State_base

using std::__future_base::_State_base = _State_baseV2

inherited

Definition at line 597 of file future.

## Constructor & Destructor Documentation

## future() [1/2]

template<typename _Res >

constexpr std::future< _Res >::future | ( |  | ) |

inline constexpr noexcept

Definition at line 785 of file future.

## future() [2/2]

template<typename _Res >

std::future< _Res >::future | ( | future< _Res > && | __uf | ) |

inline noexcept

Move constructor.

Definition at line 788 of file future.

## Member Function Documentation

## _M_get_result()

template<typename _Res >

__result_type std::__basic_future< _Res >::_M_get_result | ( |  | ) | const

inline protected inherited

Wait for the state to be ready and rethrow any stored exception.

Definition at line 716 of file future.

## _M_swap()

template<typename _Res >

void std::__basic_future< _Res >::_M_swap | ( | __basic_future< _Res > & | __that | ) |

inline protected noexcept inherited

Definition at line 725 of file future.

## _S_allocate_result() [1/2]

template<typename _Res , typename _Allocator >

static _Ptr< _Result_alloc< _Res, _Allocator > > std::__future_base::_S_allocate_result | ( | const _Allocator & | __a | ) |

inline static inherited

Definition at line 287 of file future.

## _S_allocate_result() [2/2]

template<typename _Res , typename _Tp >

static _Ptr< _Result< _Res > > std::__future_base::_S_allocate_result | ( | const std::allocator< _Tp > & | __a | ) |

inline static inherited

Definition at line 300 of file future.

## _S_task_setter()

template<typename _Res_ptr , typename _BoundFn >

static _Task_setter< _Res_ptr, _BoundFn > std::__future_base::_S_task_setter | ( | _Res_ptr & | __ptr,
|  | _BoundFn & | __call
| ) |  |

inline static inherited

Definition at line 621 of file future.

## get()

template<typename _Res >

_Res std::future< _Res >::get | ( |  | ) |

inline

Retrieving the value.

Definition at line 802 of file future.

## operator=()

template<typename _Res >

future & std::future< _Res >::operator= | ( | future< _Res > && | __fut | ) |

inline noexcept

Definition at line 794 of file future.

## valid()

template<typename _Res >

bool std::__basic_future< _Res >::valid | ( |  | ) | const

inline noexcept inherited

Definition at line 688 of file future.

## wait()

template<typename _Res >

void std::__basic_future< _Res >::wait | ( |  | ) | const

inline inherited

Definition at line 691 of file future.

## wait_for()

template<typename _Res >
template<typename _Rep , typename _Period >

future_status std::__basic_future< _Res >::wait_for | ( | const chrono::duration< _Rep, _Period > & | __rel | ) | const

inline inherited

Definition at line 699 of file future.

## wait_until()

template<typename _Res >
template<typename _Clock , typename _Duration >

future_status std::__basic_future< _Res >::wait_until | ( | const chrono::time_point< _Clock, _Duration > & | __abs | ) | const

inline inherited

Definition at line 707 of file future.

## Friends And Related Symbol Documentation

## packaged_task

template<typename _Res >
template<typename >

friend class packaged_task

friend

Definition at line 773 of file future.

## promise< _Res >

template<typename _Res >

friend class promise< _Res >

friend

Definition at line 769 of file future.

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

- future