std::future_error - cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
| Definido no cabeçalho <future> |
||
|
|
(desde C++11) | |
O std::future_error classe define um objeto de exceção que é acionada em caso de falha das funções na biblioteca thread que lidam com a execução assíncrona e estados compartilhada (std::future, std::promise, etc). Similar ao std::system_error, esta excepção carrega um código de erro compatível com std::error_code.
Original:
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.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Inheritance diagram
Funções de membro
cria um objeto Original: creates a The text has been machine-translated via Google Translate. (função pública membro) [edit] | |
retorna o código de erro Original: returns the error code The text has been machine-translated via Google Translate. (função pública membro) [edit] | |
retorna a seqüência explicativa específica para o código de erro Original: returns the explanatory string specific to the error code The text has been machine-translated via Google Translate. (função pública membro) [edit] | |
Herdado de std::logic_error
Herdado de std::exception
Member functions
destrói o objeto de exceção Original: destructs the exception object The text has been machine-translated via Google Translate. (of std::exception função pública virtual membro) [edit]
| |
retorna uma cadeia explicativa Original: returns an explanatory string The text has been machine-translated via Google Translate. (of std::exception função pública virtual membro) [edit]
| |
Exemplo
#include <future> #include <iostream> int main() { std::future<int> empty; try { int n = empty.get(); } catch (const std::future_error& e) { std::cout << "Caught a future_error with code \"" << e.code() << "\"\nMessage: \"" << e.what() << "\"\n"; } }
Saída:
Caught a future_error with code "future:3" Message: "No associated state"
Veja também
identifica os códigos de erro do futuro Original: identifies the future error codes The text has been machine-translated via Google Translate. (enum) [edit] | |