std::shared_future::valid

From cppreference.com

 
 
Thread support library
Threads
(C++11)
this_thread namespace
(C++11)
(C++11)
(C++11)
(C++11)
Mutual exclusion
(C++11)
(C++11)
(C++17)
Generic lock management
(C++11)
(C++11)
(C++14)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
(C++11)
(C++11)
Condition variables
(C++11)
Futures
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
 
 
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. Unlike std::future, std::shared_future's shared state is not invalidated when get() is called.

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

Contents

[edit] Parameters

(none)

[edit] Return value

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

[edit] Exceptions

noexcept specification:  
noexcept
  

[edit] Example

[edit] See also

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