---
name: "std::error_condition"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/std::error_condition/3cxx"
---

# std::error\_condition(3cxx)

## NAME

std::error\_condition

## SYNOPSIS

`#include <system_error>`

### Public Member Functions

**error\_condition** () noexcept\
 Initialize with a zero (no error) value and the generic category.  template\<**typename** **\_ErrorConditionEnum** , **typename**  = typename enable\_if\<is\_error\_condition\_enum\<\_ErrorConditionEnum\>::value\>::type\> **error\_condition** (**\_ErrorConditionEnum** \_\_e) noexcept\
 **error\_condition** (int **\_\_v**, const **error\_category** &**\_\_cat**) noexcept\
 Initialize with the specified value and category.  **void** **assign** (int **\_\_v**, const **error\_category** &**\_\_cat**) noexcept\
 Set the value and category.  const **error\_category** & **category** () const noexcept\
 The error category that this error belongs to.  **void** **clear** () noexcept\
 Reset the value and category to the default-constructed state.  **string** **message** () const\
 The category's description of the value.  **operator bool** () const noexcept\
 Test whether `value()` is non-zero.  template\<**typename** **\_ErrorConditionEnum** \> **enable\_if**\< **is\_error\_condition\_enum**\< **\_ErrorConditionEnum** \>**::value**, **error\_condition** & \>::type **operator=** (**\_ErrorConditionEnum** \_\_e) noexcept\
 int **value** () const noexcept\
 The error value.

### Related Symbols

(Note that these are not member symbols.)  **error\_condition** **make\_error\_condition** (errc \_\_e) noexcept\
 bool **operator!=** (const **error\_condition** &**\_\_lhs**, const **error\_code** &**\_\_rhs**) noexcept\
 bool **operator!=** (const **error\_condition** &**\_\_lhs**, const **error\_condition** &**\_\_rhs**) noexcept\
 bool **operator\<** (const **error\_condition** &**\_\_lhs**, const **error\_condition** &**\_\_rhs**) 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\_condition** &**\_\_lhs**, const **error\_code** &**\_\_rhs**) noexcept\
 bool **operator==** (const **error\_condition** &**\_\_lhs**, const **error\_condition** &**\_\_rhs**) noexcept\

## Detailed Description

Class error\_condition

This class represents error conditions that may be visible at an API boundary. Different `error_code` values that can occur within a library or module might map to the same `error_condition`.

An `error_condition` represents something that the program can test for, and subsequently take appropriate action.

**Since**

C++11

## Constructor & Destructor Documentation

### std::error\_condition::error\_condition ()` [inline]`, ` [noexcept]`

Initialize with a zero (no error) value and the generic category.

### std::error\_condition::error\_condition (int \_\_v, const error\_category & \_\_cat)` [inline]`, ` [noexcept]`

Initialize with the specified value and category.

## Member Function Documentation

### void std::error\_condition::assign (int \_\_v, const error\_category & \_\_cat)` [inline]`, ` [noexcept]`

Set the value and category.

### const error\_category & std::error\_condition::category () const` [inline]`, ` [noexcept]`

The error category that this error belongs to.

### void std::error\_condition::clear ()` [inline]`, ` [noexcept]`

Reset the value and category to the default-constructed state.

### string std::error\_condition::message () const` [inline]`

The category's description of the value.

### std::error\_condition::operator bool () const` [inline]`, ` [explicit]`, ` [noexcept]`

Test whether `value()` is non-zero.

### int std::error\_condition::value () const` [inline]`, ` [noexcept]`

The error value.

## Author

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