# std::future::valid

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

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

Checks if the future refers to a shared state.

This is the case only for futures that were not default-constructed or moved from (i.e. returned by std::promise::get_future(), std::packaged_task::get_future() or std::async()) until the first time get() or share() is called.

The behavior is undefined if any member function other than the destructor, the move-assignment operator, or `valid` is called on a `future` that does not refer to shared state (although implementations are encouraged to throw std::future_error indicating `no_state` in this case). It is valid to move from a future object for which `valid()` is `false`

### Parameters

(none)

### Return value

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

### Exceptions

`noexcept` specification:
noexcept

### Example

| This section is incomplete Reason: no example

### See also

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

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

- unconditionally noexcept
- Todo no example

Hidden categories:

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