---
name: "std::future"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/std::future/3cxx"
---

# std::future(3cxx)

Primary template for future.

## NAME

std::future\< \_Res \> - Primary template for future.

## SYNOPSIS

`#include <future>`

Inherits **std::\_\_basic\_future\< \_Res \>**.

### Public Member Functions

**future** (const **future** &)=**delete**\
 **future** (**future** &&**\_\_uf**) noexcept\
 Move constructor.  **\_Res** **get** ()\
 Retrieving the value.  **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\

### Protected Types

**typedef** \_\_future\_base::\_Result\< **\_Res** \> & **\_\_result\_type**\

### Protected Member Functions

\_\_result\_type **\_M\_get\_result** () const\
 Wait for the state to be ready and rethrow any stored exception.  **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.

## Constructor & Destructor Documentation

### template\<typename \_Res \> std::future\< \_Res \>::future (future\< \_Res \> && \_\_uf)` [inline]`, ` [noexcept]`

Move constructor.

## Member Function Documentation

### 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.

### template\<typename \_Res \> \_Res std::future\< \_Res \>::get ()` [inline]`

Retrieving the value.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
