std::system_error
De cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Defined in header <system_error>
|
||
class system_error; |
(desde C++11) | |
std::system_error
es el tipo de la excepción lanzada por varias funciones de la biblioteca (por lo general las funciones que interactúan con las instalaciones del sistema operativo, por ejemplo, el constructor de std::thread), cuando la excepción se ha asociado a un std::error_code que debe ser reportado .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.
You can help to correct and verify the translation. Click here for instructions.
Contenido |
[editar] Las funciones miembro
construye el objeto system_error Original: constructs the system_error objectThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (miembro público función) | |
devuelve el código de error Original: returns error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (miembro público función) | |
[virtual] |
devuelve una cadena explicativa Original: returns explanatory string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Virtual Member público función) |
Inherited from std::exception
Member functions
[virtual] |
destructs el objeto de excepción Original: destructs the exception object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Virtual Member público of std::exception función)
|
[virtual] |
devuelve una cadena explicativa Original: returns an explanatory string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Virtual Member público of std::exception función)
|
[editar] Ejemplo
#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'; } }
Output:
Caught system_error with code generic:22 meaning Invalid argument