std::system_error - cppreference.com
Da cppreference.com.
|
|
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
<metanoindex/>
<tbody> </tbody>
| Elemento definito nell'header <system_error> |
||
|
|
(dal C++11) | |
std::system_error è il tipo di eccezione lanciata da varie funzioni di libreria (in genere le funzioni che si interfacciano con il sistema operativo servizi, ad esempio il costruttore di std::thread), quando l'eccezione ha un std::error_code associato che deve essere segnalato.
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
Membri funzioni
costruisce l'oggetto Original: constructs the The text has been machine-translated via Google Translate. (metodo pubblico) [modifica] | |
restituisce il codice di errore Original: returns error code The text has been machine-translated via Google Translate. (metodo pubblico) [modifica] | |
[virtuale] |
restituisce stringa esplicativa Original: returns explanatory string The text has been machine-translated via Google Translate. (metodo pubblico virtuale) [modifica] |
Inherited from std::exception
Member functions
distrugge l'oggetto eccezione Original: destructs the exception object The text has been machine-translated via Google Translate. (metodo pubblico virtuale) [modifica] | |
restituisce una stringa esplicativa Original: returns an explanatory string The text has been machine-translated via Google Translate. (metodo pubblico virtuale) [modifica] | |
Esempio
#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