std::error_category(3cxx)
π¦ std::error_category π¦
okay bestie, welcome to the std::error_category(3cxx) manual page from libstdc++ β and it's giving "abstract base class for error codes" but make it make sense, yeah? π
πΈ NAME πΈ
std::error_category β literally the name, no cap.
β¨ SYNOPSIS β¨
#include <system_error>
π Public Member Functions π
error_category (const error_category &)=deleteβ this one is=delete; the compiler said no copying, bestie.virtual error_condition default_error_condition (int __i) const noexceptβ return anerror_conditioncorresponding toiin this category.virtual bool equivalent (const error_code &__code, int __i) const noexceptβ test whethercodecorresponds toifor this category.virtual bool equivalent (int __i, const error_condition &__cond) const noexceptβ test whethercondcorresponds toifor this category.virtual string message (int) const =0β the=0is right there, bestie.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β assignment is also=delete; not here for the copy-paste era.bool operator== (const error_category &__other) const noexceptβ anerror_categoryonly compares equal to itself.
π Detailed Description π
okay so std::error_category is an abstract base class for types defining a category of error codes. It's the context machine that gives meaning to the integer stored in an error_code or error_condition object.
For example, the standard errno constants like 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. Same number, different lore β iykyk.
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. That's the crossover episode energy, fr fr.
π 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 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], [noexcept]
Ordered comparison that defines a total order for error categories.
π 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. So you know who to thank for the autogenerated lore, bestie.
Footer vibe check: source/version shoutout goes to libstdc++, manual name is std::error_category(3cxx), and the footer date is literally not shown on this page β don't @ me. Bye bestie, slay your error categories π
β¨
π¦ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms