std::system_error - cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
| Definido no cabeçalho <system_error> |
||
|
|
(desde C++11) | |
std::system_error é o tipo da exceção lançada por várias funções de biblioteca (normalmente as funções que fazem interface com as instalações do sistema operacional, por exemplo, o construtor de std::thread), quando a exceção tem um std::error_code associado, que terá de ser comunicado.
Original:
std::system_error is the type of the exception thrown by various library functions (typically the functions that interface with the OS facilities, e.g. the constructor of std::thread), when the exception has an associated std::error_code which needs to be reported.
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
constrói o objeto Original: constructs the The text has been machine-translated via Google Translate. (função pública membro) [edit] | |
retorna código de erro Original: returns error code The text has been machine-translated via Google Translate. (função pública membro) [edit] | |
[virtual] |
Retorna a string explicativo Original: returns explanatory string The text has been machine-translated via Google Translate. (função pública virtual membro) [edit] |
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 <thread> #include <iostream> #include <system_error> int main() { try { std::thread().detach(); // attempt to detach a non-thread } catch(const std::system_error& e) { std::cout << "Caught system_error with code " << e.code() << " meaning " << e.what() << '\n'; } }
Saída:
Caught system_error with code generic:22 meaning Invalid argument