Documentation Home >> Headers >> <system_error> Header >> std::error_code class

Instances of std::error_code hold error code values such as those reported by operating system functions.

class error_code
{
public:
    error_code();
    error_code(int val, const error_category& cat);
    template <class ErrorCodeEnum>
    error_code(ErrorCodeEnum e);

    void assign(int val, const error_category& cat);
    template <class ErrorCodeEnum>
    error_code& operator=(ErrorCodeEnum e);
    void clear();

    int value() const;
    const error_category& category() const;
    error_condition default_error_condition() const;
    std::string message() const;
    explicit operator bool() const;
};
Header

#include <system_error>

See Also