class future_error;
(since C++11)The class std::future_error defines an exception object that is thrown on failure by the functions in the thread library that deal with asynchronous execution and shared states (std::future, std::promise, etc). Similar to std::system_error, this exception carries an error code compatible with std::error_code.
Inheritance diagram
[edit] Member functions creates astd::future_error
object
std::future_error
object
std::exception
) [edit] returns an explanatory string
std::exception
) [edit] [edit] Example
#include <future> #include <iostream> int main() { std::future<int> empty; try { int n = empty.get(); // The behavior is undefined, but // some implementations throw std::future_error } catch (const std::future_error& e) { std::cout << "Caught a future_error with code \"" << e.code() << "\"\nMessage: \"" << e.what() << "\"\n"; } }
Possible output:
Caught a future_error with code "future:3" Message: "No associated state"[edit] See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4