FreeBSD Manual Pages
std::system_error(3) C++ Standard Libary std::system_error(3) NAME std::system_error - std::system_error Synopsis Defined in header <system_error> class system_error; (since C++11) std::system_error is the type of the exception thrown by various li- brary functions (typically the functions that interface with the OS facilities, e.g. the constructor of std::thread) when the exception has an associated std::er- ror_code, which may be reported. std-system error-inheritance.svg Inheritance diagram Member functions constructor constructs the system_error object (public member function) operator= replaces the system_error object (public member function) code returns error code (public member function) what returns an explanatory string [virtual] (virtual public member function) Inherited from std::exception Member functions destructor destroys the exception object [virtual] (virtual public member function of std::exception) what returns an explanatory string [virtual] (virtual public member function of std::exception) Example // Run this code #include <iostream> #include <system_error> #include <thread> 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"; } } Possible output: Caught system_error with code [generic:22] meaning [Invalid argument] http://cppreference.com 2024.06.10 std::system_error(3)
NAME | Synopsis | Member functions | Member functions | Example | Possible output:
Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::system_error&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>
