std::system_category
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. |
Elemento definito nell'header <system_error>
|
||
const std::error_category& system_category(); |
(dal C++11) | |
Ottiene un riferimento all'oggetto statico categoria di errore per gli errori segnalati dal sistema operativo. L'oggetto è necessario eseguire l'override della funzione virtuale error_category::name() per restituire un puntatore alla stringa "system". E 'anche necessario eseguire l'override della funzione virtuale error_category::default_error_condition() per mappare i codici di errore che corrispondono POSIX errno valori std::generic_category.
Original:
Obtains a reference to the static error category object for errors reported by the operating system. The object is required to override the virtual function error_category::name() to return a pointer to the string "system". It is also required to override the virtual function error_category::default_error_condition() to map the error codes that match POSIX errno values to std::generic_category.
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.
Indice |
[modifica] Parametri
(Nessuno)
Original:
(none)
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.
[modifica] Valore di ritorno
Un riferimento all'oggetto statico del tipo di runtime non specificato, derivato da std::error_category.
Original:
A reference to the static object of unspecified runtime type, derived from std::error_category.
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.
[modifica] Eccezioni
[modifica] Esempio
#include <iostream> #include <system_error> #include <iomanip> #include <string> int main() { std::error_condition econd = std::system_category().default_error_condition(EDOM); std::cout << "Category: " << econd.category().name() << '\n' << "Value: " << econd.value() << '\n' << "Message: " << econd.message() << '\n'; econd = std::system_category().default_error_condition(10001); std::cout << "Category: " << econd.category().name() << '\n' << "Value: " << econd.value() << '\n' << "Message: " << econd.message() << '\n'; }
Output:
Category: generic Value: 33 Message: Numerical argument out of domain Category: system Value: 10001 Message: Unknown error 10001
[modifica] Vedi anche
(C++11) |
identifica la categoria di errore generico Original: identifies the generic error category The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione) |
(C++11) |
l'enumerazione std::error_condition elenco di tutti gli standard <cerrno> costanti macroOriginal: the std::error_condition enumeration listing all standard <cerrno> macro constantsThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe) |