std error codes

std::error_code came originally from boost::error_code which was designed around 2008 as part of implementing Filesystem and Networking. They are a simple trivially copyable type offering improved type safety and functionality over C enumerations. You can read more about how std::error_code works here. They were standardised in the C++ 11 standard, and have been available in Boost since 2008.

Pros:

Cons:

(Note that this long list of design caveats is what led to the proposed superseding of std::error_code with std::error, which you can use today in Outcome.Experimental. See this page for more information).