---
name: "std::error_category"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/std::error_category"
---

# std::error\_category(3)

## NAME

std::error\_category

## SYNOPSIS

\#include \<system\_error\>

### Public Member Functions

**error\_category** (const error\_category &)=delete\
 virtual **error\_condition** **default\_error\_condition** (int \_\_i) const noexcept\
 Return an error\_condition corresponding to i in this category.  virtual bool **equivalent** (const **error\_code** &\_\_code, int \_\_i) const noexcept\
 Test whether code corresponds to i for this category.  virtual bool **equivalent** (int \_\_i, const **error\_condition** &\_\_cond) const noexcept\
 Test whether cond corresponds to i for this category.  virtual **string** **message** (int) const =0\
 A description of the error condition corresponding to the number.  virtual const char \* **name** () const noexcept=0\
 A string that identifies the error category.  strong\_ordering **operator\<=\>** (const error\_category &\_\_rhs) const noexcept\
 Ordered comparison that defines a total order for error categories.  error\_category & **operator=** (const error\_category &)=delete\
 bool **operator==** (const error\_category &\_\_other) const noexcept\
 An error\_category only compares equal to itself.

## Detailed Description

Abstract base class for types defining a category of error codes.

An error category defines a context that gives meaning to the integer stored in an error\_code or error\_condition object. For example, the standard errno constants such a EINVAL and ENOMEM are associated with the "generic" category and other OS-specific error numbers are associated with the "system" category, but a user-defined category might give different meanings to the same numerical values.

A user-defined category can override the equivalent member functions to define correspondence between errors in different categories. For example, a category for errors from disk I/O could consider some of its error numbers equivalent to ENOSPC and ENOENT in the generic category.

**Since**

C++11

## Member Function Documentation

### virtual error\_condition std::error\_category::default\_error\_condition (int \_\_i) const \[virtual\], \[noexcept\]

Return an error\_condition corresponding to i in this category.

### virtual bool std::error\_category::equivalent (const error\_code & \_\_code, int \_\_i) const \[virtual\], \[noexcept\]

Test whether code corresponds to i for this category.

### virtual bool std::error\_category::equivalent (int \_\_i, const error\_condition & \_\_cond) const \[virtual\], \[noexcept\]

Test whether cond corresponds to i for this category.

### virtual string std::error\_category::message (int ) const \[pure virtual\]

A description of the error condition corresponding to the number.

References **message()**.

Referenced by **message()**, **std::error\_code::message()**, and **std::error\_condition::message()**.

### virtual const char \* std::error\_category::name () const \[pure virtual\], \[noexcept\]

A string that identifies the error category.

### strong\_ordering std::error\_category::operator\<=\> (const error\_category & \_\_rhs) const \[inline\], \[nodiscard\], \[noexcept\]

Ordered comparison that defines a total order for error categories.

References **operator\<=\>()**.

Referenced by **operator\<=\>()**.

### bool std::error\_category::operator== (const error\_category & \_\_other) const \[inline\], \[noexcept\]

An error\_category only compares equal to itself.

## Author

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