std::shared_future::shared_future - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::shared_future::shared_future

From cppreference.com
< cpp‎ | thread‎ | shared future

shared_future(); | (1) | (since C++11)
shared_future( const shared_future& other ); | (2) | (since C++11)
shared_future( std::future<T>&& other ); | (3) | (since C++11)
shared_future( shared_future&& other ); | (4) | (since C++11)

Constructs a new `shared_future`.

1) Default constructor. Constructs an empty shared future, that doesn't refer to a shared state, that is valid() == false.
2) Constructs a shared future that refers to the same shared state, as `other`, if there's any.
3-4) Transfers the shared state held by `other` to *this. After the construction, other->valid() == false, also valid() returns the same value as other.valid() would have returned before the construction.

### [edit] Parameters

other | - | another future object to initialize with

### [edit] Exceptions

1)
`noexcept` specification:
noexcept

2) (none) | (until C++17)
2) `noexcept` specification: noexcept | (since C++17)

3-4)
`noexcept` specification:
noexcept
Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/thread/shared_future/shared_future&oldid=91627"
Category:

- unconditionally noexcept

Hidden categories:

- Pages with unreviewed unconditional noexcept template
- Pages with unreviewed noexcept template