std::error_code - Man Page

Synopsis

#include <system_error>

Public Member Functions

template<typename _ErrorCodeEnum , typename  = _Check<_ErrorCodeEnum>> error_code (_ErrorCodeEnum __e) noexcept
Initialize with a user-defined type, by calling make_error_code.
error_code (const error_code &)=default
error_code (int __v, const error_category &__cat) noexcept
void assign (int __v, const error_category &__cat) noexcept
const error_category & category () const noexcept
The error category that this error belongs to.
void clear () noexcept
error_condition default_error_condition () const noexcept
An error_condition for this error's category and value.
string message () const
The category's description of the value.
operator bool () const noexcept
Test whether value() is non-zero.
error_code & operator= (const error_code &)=default
int value () const noexcept
The error value.

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 223 of file system_error.

Constructor & Destructor Documentation

std::error_code::error_code () [inline], [noexcept]

Definition at line 230 of file system_error.

std::error_code::error_code (int __v, const error_category & __cat) [inline], [noexcept]

Definition at line 233 of file system_error.

template<typename _ErrorCodeEnum , typename  = _Check<_ErrorCodeEnum>> std::error_code::error_code (_ErrorCodeEnum __e) [inline], [noexcept]

Initialize with a user-defined type, by calling make_error_code.

Definition at line 239 of file system_error.

Member Function Documentation

void std::error_code::assign (int __v, const error_category & __cat) [inline], [noexcept]

Definition at line 249 of file system_error.

const error_category & std::error_code::category () const [inline], [noexcept]

The error category that this error belongs to.

Definition at line 267 of file system_error.

void std::error_code::clear () [inline], [noexcept]

Definition at line 256 of file system_error.

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

An error_condition for this error's category and value.

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

The category's description of the value.

Definition at line 276 of file system_error.

std::error_code::operator bool () const [inline], [explicit], [noexcept]

Test whether value() is non-zero.

Definition at line 281 of file system_error.

int std::error_code::value () const [inline], [noexcept]

The error value.

Definition at line 262 of file system_error.

Author

Generated automatically by Doxygen for libstdc++ from the source code.

Info

Thu Jan 19 2023 libstdc++