std::future::valid - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::future::valid

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

[edit template]

bool valid() const; |  | (since C++11)

Checks if the future refers to a shared state. This is the case only for futures returned by std::promise::get_future(), std::packaged_task::get_future() or std::async() until the first time get()or share() is called.

### [edit] Parameters

(none)

### [edit] Return value

true if *this refers to a shared state, otherwise false.

### [edit] Exceptions

`noexcept` specification:
noexcept

### [edit] Example

| This section is incomplete Reason: no example

### [edit] See also

wait | waits for the result to become available (public member function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/thread/future/valid&oldid=51359"
Categories:

- unconditionally noexcept
- Todo no example