<system_error> categories and standard/system error codes
C++11 introduced the <system_error> header containing a generic system to handle error codes. An std::error_code is a tuple containing an int , the error code, and a reference to an std::error_category , which defines the error domain and handling of the error code. The standard library comes with four categories: std::generic_category , std::system_category , std::future_category , and std::iostream_category . There are conflicts on which category to use, both here on SO and on C++ reference sites, when creating std::error_code s/throwing std::system_error s with errno and WinAPI error codes: