public member function
<future>
std::future_error::codeconst error_code& code() const noexcept;
Get error code
Returns the error_code object associated with the exception.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// future_error::code example:
#include <iostream> // std::cout
#include <future> // std::promise, std::future_error
#include <string> // operator<<(ostream&,const string&)
int main ()
{
std::promise<int> prom;
try {
prom.get_future();
prom.get_future(); // throws std::future_error
}
catch (std::future_error& e) {
std::cout << "future_error caught: " << e.code().message() << '\n';
}
return 0;
}
future_error caught: promise already satisfied
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