FreeBSD Manual Pages
std::system...system_error(3) C++ Standard Libarystd::system...system_error(3) NAME std::system_error::system_error - std::system_error::system_error Synopsis system_error( std::error_code ec ); (1) (since C++11) system_error( std::error_code ec, const std::string& what_arg ); (2) (since C++11) system_error( std::error_code ec, const char* what_arg ); (2) (since C++11) system_error( int ev, const std::error_category& ecat ); (3) (since C++11) system_error( int ev, const std::error_category& ecat, (4) (since C++11) const std::string& what_arg ); system_error( int ev, const std::error_category& ecat, (4) (since C++11) const char* what_arg ); system_error( const system_error& other ) noexcept; (5) (since C++11) Constructs new system error object. 1) Constructs with error code ec 2) Constructs with error code ec and explanation string what_arg. The string returned by what() is guaranteed to contain what_arg as a substring. 3) Constructs with underlying error code ev and associated error category ecat. 4) Constructs with underlying error code ev, associated error cate- gory ecat and explanatory string what_arg. The string returned by what() is guar- anteed to contain what_arg as a substring (assuming that it doesn't contain an embed- ded null character ). 5) Copy constructor. Initializes the contents with those of other. If *this and other both have dynamic type std::system_error then std::str- cmp(what(), other.what()) == 0. Parameters ec - error code ev - underlying error code in the enumeration associated with ecat ecat - the category of error what_arg - explanatory string other - another system_error to copy Example Demonstrates how to create a system_error exception from an errno value. // Run this code #include <iostream> #include <system_error> int main() { try { throw std::system_error(EDOM, std::generic_category(), "hello world"); } catch (const std::system_error& ex) { std::cout << ex.code() << '\n'; std::cout << ex.code().message() << '\n'; std::cout << ex.what() << '\n'; } } Possible output: generic:33 Numerical argument out of domain hello world: Numerical argument out of domain http://cppreference.com 2022.07.31 std::system...system_error(3)
NAME | Synopsis | Parameters | Example | Possible output:
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::system_error::system_error&sektion=3&manpath=FreeBSD+Ports+15.0>
