libstdc++
std::error_code Class Reference

#include <system_error>

Public Member Functions

template<typename _ErrorCodeEnum , typename = typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value>::type>
 error_code (_ErrorCodeEnum __e) noexcept
 
 error_code (int __v, const error_category &__cat) noexcept
 
void assign (int __v, const error_category &__cat) noexcept
 
const error_categorycategory () const noexcept
 
void clear () noexcept
 
error_condition default_error_condition () const noexcept
 
string message () const
 
 operator bool () const noexcept
 
template<typename _ErrorCodeEnum >
enable_if< is_error_code_enum< _ErrorCodeEnum >::value, error_code & >::type operator= (_ErrorCodeEnum __e) noexcept
 
int value () const noexcept
 

Related Symbols

(Note that these are not member symbols.)

error_code make_error_code (errc __e) noexcept
 
bool operator!= (const error_code &__lhs, const error_code &__rhs) noexcept
 
bool operator!= (const error_code &__lhs, const error_condition &__rhs) noexcept
 
bool operator< (const error_code &__lhs, const error_code &__rhs) noexcept
 
template<typename _CharT , typename _Traits >
basic_ostream< _CharT, _Traits > & operator<< (basic_ostream< _CharT, _Traits > &__os, const error_code &__e)
 

Detailed Description

Class error_code

This class is a value type storing an integer error number and a category that gives meaning to the error number. Typically this is done close the the point where the error happens, to capture the original error value.

An error_code object can be used to store the original error value emitted by some subsystem, with a category relevant to the subsystem. For example, errors from POSIX library functions can be represented by an errno value and the "generic" category, but errors from an HTTP library might be represented by an HTTP response status code (e.g. 404) and a custom category defined by the library.

Since
C++11

Definition at line 220 of file system_error.

Constructor & Destructor Documentation

◆ error_code() [1/3]

std::error_code::error_code ( )
inlinenoexcept

Definition at line 223 of file system_error.

◆ error_code() [2/3]

std::error_code::error_code ( int  __v,
const error_category __cat 
)
inlinenoexcept

Definition at line 226 of file system_error.

◆ error_code() [3/3]

template<typename _ErrorCodeEnum , typename = typename enable_if<is_error_code_enum<_ErrorCodeEnum>::value>::type>
std::error_code::error_code ( _ErrorCodeEnum  __e)
inlinenoexcept

Definition at line 231 of file system_error.

Member Function Documentation

◆ assign()

void std::error_code::assign ( int  __v,
const error_category __cat 
)
inlinenoexcept

Definition at line 238 of file system_error.

◆ category()

const error_category & std::error_code::category ( ) const
inlinenoexcept

The error category that this error belongs to.

Definition at line 263 of file system_error.

◆ clear()

void std::error_code::clear ( )
inlinenoexcept

Definition at line 245 of file system_error.

◆ default_error_condition()

error_condition std::error_code::default_error_condition ( ) const
noexcept

An error_condition for this error's category and value.

◆ message()

string std::error_code::message ( ) const
inline

The category's description of the value.

Definition at line 272 of file system_error.

◆ operator bool()

std::error_code::operator bool ( ) const
inlineexplicitnoexcept

Test whether value() is non-zero.

Definition at line 277 of file system_error.

◆ operator=()

template<typename _ErrorCodeEnum >
enable_if< is_error_code_enum< _ErrorCodeEnum >::value, error_code & >::type std::error_code::operator= ( _ErrorCodeEnum  __e)
inlinenoexcept

Definition at line 252 of file system_error.

◆ value()

int std::error_code::value ( ) const
inlinenoexcept

The error value.

Definition at line 258 of file system_error.


The documentation for this class was generated from the following file: