Namespaces
Variants
Views
Actions

std::error_code

From cppreference.com
< cpp‎ | error
 
 
Utilities library
Language support
Type support (basic types, RTTI)
Library feature-test macros (C++20)
Dynamic memory management
Program utilities
Coroutine support (C++20)
Variadic functions
Debugging support
(C++26)
Three-way comparison
(C++20)
(C++20)(C++20)(C++20)
(C++20)(C++20)(C++20)
General utilities
Date and time
Function objects
Formatting library (C++20)
(C++11)
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)   
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)
Elementary string conversions
(C++17)
(C++17)

 
Diagnostics library
Exception handling
Exception handling failures
(until C++17*)
(until C++17*)
(C++11)(until C++17*)    
(until C++17*)
Error codes
Error codes
Exception categories
System error support
(C++11)
error_code
(C++11)
Assertions
Stacktrace
 
 
Defined in header <system_error>
class error_code;
(since C++11)

std::error_code represents a platform-dependent error code value. Each std::error_code object holds an error code value 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 are not required to be unique across different error categories.

Contents

[edit] Member functions

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

[edit] Non-member functions

(removed in C++20)(removed in C++20)(C++20)
compares two error_codes
(function) [edit]
outputs the value and the category name to an output stream
(function) [edit]

[edit] Helper classes

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

[edit] See also

holds a portable error code
(class) [edit]
base class for error categories
(class) [edit]
creates error code value for errc enum e
(function) [edit]