##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::error_code

From cppreference.com
< cpp‎ | error

Defined in header `<system_error>` |  |
class error_code; |  | (since C++11)

`std::error_code` is a platform-dependent error code. Each `std::error_code` object holds an error code originating from the operating system or some low-level interface and a pointer to an object of type std::error_category, which corresponds to the said interface. The error code values may be not unique across different error categories.

### [edit] Member functions

(constructor) | constructs an error code (public member function) [edit]
operator= | assigns another error code (public member function) [edit]
assign | assigns another error code (public member function) [edit]
##### Modifiers
clear | sets the error_code to value 0 in system_category (public member function) [edit]
##### Observers
value | obtains the value of the error_code (public member function) [edit]
category | obtains the error_category for this error_code (public member function) [edit]
default_error_condition | obtains the error_condition for this error_code (public member function) [edit]
message | obtains the explanatory string for this error_code (public member function) [edit]
operator bool | checks if the value is non-zero (public member function) [edit]

### [edit] Non-member functions

operator==operator!=operator< | compares two `error_code`s (function) [edit]
operator<< | outputs the value and the category name to an output stream (function) [edit]

### [edit] Helper classes

is_error_code_enum (C++11) | identifies a class as an error_code enumeration (class template) [edit]
std::hash<std::error_code> (C++11) | hash support for std::error_code (class template specialization) [edit]

### [edit] See also

error_condition (C++11) | holds a portable error code (class) [edit]
error_category (C++11) | base class for error categories (class) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/error/error_code&oldid=90184"