std::future_errc

From cppreference.com
< cpp‎ | thread
 
 
Thread support library
Threads
(C++11)
this_thread namespace
(C++11)
(C++11)
(C++11)
Mutual exclusion
(C++11)
Generic lock management
(C++11)
(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)
future_errc
(C++11)
 
std::future_errc
Non-member functions
Helper classes
 
Defined in header <future>
enum class future_errc {

    broken_promise             = /* implementation-defined */,
    future_already_retrieved   = /* implementation-defined */,
    promise_already_satisfied  = /* implementation-defined */,
    no_state                   = /* implementation-defined */

};
(since C++11)

The scoped enumeration std::future_errc defines the error codes reported by std::future and related classes in std::future_error exception objects. Only four error codes are required, although the implementation may define additional error codes. Because the appropriate specialization of std::is_error_code_enum is provided, values of type std::future_errc are implicitly convertible to std::error_code.

All error codes are distinct and non-zero. (since C++14)

Member constants

Constant Explanation
broken_promise the asynchronous task abandoned its shared state
future_already_retrieved the contents of shared state were already accessed through std::future
promise_already_satisfied attempt to store a value in the shared state twice
no_state attempt to access std::promise or std::future without an associated shared state

Non-member functions

constructs a future error code
(function)
constructs a future error_condition
(function)

Helper classes

extends the type trait std::is_error_code_enum to identify future error codes
(class template)

Notes

In C++11, broken_promise was specified to equal zero despite std::error_code/std::error_condition using zero to mean "no error". This was fixed in C++14.

Example

See also

holds a platform-dependent error code
(class)
holds a portable error code
(class)