std::error_code

From cppreference.com
< cpp‎ | error
 
 
Utilities library
Type support (basic types, RTTI, type traits)
Dynamic memory management
Error handling
Program utilities
Variadic functions
Date and time
Function objects
(C++11)
Relational operators
Optional and any
(C++17)
(C++17)
Pairs and tuples
(C++11)
(C++17)
Swap, forward and move
(C++14)
(C++11)
(C++11)
Type operations
(C++11)
(C++17)
 
Error handling
Exception handling
(C++11)
(C++17)
Exception handling failures
(C++11)
(deprecated)
(deprecated)
(C++11)(deprecated)
(deprecated)
Exception categories
Error codes
Error codes
Assertions
system_error facility
(C++11)
(C++11)
(C++11)
(C++11)
error_code
(C++11)
(C++11)
 
 
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 a pair of 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.

Contents

[edit] Member functions

constructs an error code
(public member function)
assigns another error code
(public member function)
assigns another error code
(public member function)
Modifiers
sets the error_code to value 0 in system_category
(public member function)
Observers
obtains the value of the error_code
(public member function)
obtains the error_category for this error_code
(public member function)
obtains the error_condition for this error_code
(public member function)
obtains the explanatory string for this error_code
(public member function)
checks if the value is non-zero
(public member function)

[edit] Non-member functions

compares two error_codes
(function)
outputs the value and the category name to an output stream
(function)

[edit] Helper classes

identifies a class as an error_code enumeration
(class template)
hash support for std::error_code
(class template specialization)

[edit] See also

holds a portable error code
(class)
base class for error categories
(class)