Espacios de nombres
Variantes

std::system_error::system_error

De cppreference.com
 
 
Biblioteca de servicios
Apoyo del lenguaje
Apoyo de tipos (tipos básicos, RTTI)
Macros de prueba de característica de la biblioteca (C++20)
Servicios de programa
Funciones variádicas
Apoyo de corrutinas (C++20)
Apoyo de contratos (C++26)
Comparación de tres vías (C++20)
(C++20)
(C++20)(C++20)(C++20)  
(C++20)(C++20)(C++20)

 
 
 
system_error( std::error_code ec );
(1) (desde C++11)
system_error( std::error_code ec, const std::string& what_arg );
(2) (desde C++11)
system_error( std::error_code ec, const char* what_arg );
(2) (desde C++11)
system_error( int ev, const std::error_category& ecat
(3) (desde C++11)
system_error( int ev, const std::error_category& ecat,
              const std::string& what_arg);
(4) (desde C++11)
system_error( int ev, const std::error_category& ecat,
              const char* what_arg);
(4) (desde C++11)
Construye objeto nuevo error del sistema .
Original:
Constructs new system error object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
Las construcciones con ec código de error
Original:
Constructs with error code ec
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Las construcciones con ec código de error y what_arg cadena explicación. La cadena devuelta por what() está garantizado para contener what_arg .
Original:
Constructs with error code ec and explanation string what_arg. The string returned by what() is guaranteed to contain what_arg.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
Las construcciones con ev subyacente código de error y categoría asociada error ecat .
Original:
Constructs with underlying error code ev and associated error category ecat.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
Las construcciones con ev subyacente código de error, error asociado ecat categoría y what_arg cadena explicativa. La cadena devuelta por what() está garantizado para contener what_arg .
Original:
Constructs with underlying error code ev, associated error category ecat and explanatory string what_arg. The string returned by what() is guaranteed to contain what_arg.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Parámetros

ec -
código de error
Original:
error code
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ev -
el código de error en la codificación de base
Original:
error code in base encoding
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ecat -
la categoría de error
Original:
the category of error
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
what_arg -
cadena explicativa
Original:
explanatory string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Ejemplo

Muestra cómo crear una excepción SYSTEM_ERROR de un valor errno
Original:
Demonstrates how to create a system_error exception from a errno value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>
#include <system_error>

int main()
{
    try
    {
        throw std::system_error(EDOM, std::system_category());
    }
    catch (const std::system_error& error)
    {
        std::cout << "Error: " << error.code()
                  << " - " << error.code().message() << '\n';
    }
}

Salida:

Error: system:33 - Numerical argument out of domain
Morty Proxy This is a proxified and sanitized view of the page, visit original site.