std::error_category(3cxx)
π std::error_category β a deep dive, bestie edition
okay so welcome to std::error_category(3cxx), straight out of libstdc++, and honestly? this one's kind of a big deal. it's the abstract base class that gives vibes β and meaning β to your error codes. let's get into it π
β¨ NAME β¨
std::error_category β the main character of error code categorization. no cap.
πΈ SYNOPSIS πΈ
π«Ά Public Member Functions
error_category (const error_category &)=deleteβ copy constructor? deleted. not allowed. not today. π ββοΈvirtual error_condition default_error_condition (int __i) const noexceptβ hands you the defaulterror_conditionfor the int__i. it'snoexcept, so no drama.virtual bool equivalent (const error_code &__code, int __i) const noexceptβ checks if__codeand the int__iare equivalent.noexcept, obviously.virtual bool equivalent (int __i, const error_condition &__cond) const noexceptβ same energy, but the other way around: int__ivs. theerror_condition__cond. alsonoexcept.virtual string message (int) const =0β pure virtual, so you have to write it. returns the message string for an int. yes it's on you bestie πvirtual const char * name () const noexcept=0β also pure virtual, also your problem. returns the category name as aconst char *, and it'snoexcept.bool operator!= (const error_category &__other) const noexceptβ are these two categories not the same?noexcept, so chill.bool operator< (const error_category &__other) const noexceptβ ordering comparison against__other.noexcept. slay for sorting.error_category & operator= (const error_category &)=deleteβ assignment? deleted. absolutely not. πbool operator== (const error_category &__other) const noexceptβ are they equal?noexcept. iconic.
π¦ Detailed Description π¦
Abstract base class for types defining a category of error codes. literally what it says on the tin, and it ate.
An error category defines a context that gives meaning to the integer stored in an error_code or error_condition object. like, the integer alone is just a number β the category is what tells you what that number means. it's giving translator energy. π
For example, the standard errno constants such as 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. so like, same int, completely different storyline. main character energy for real. π
β Since
C++11 β she's been here a minute, respect the elder. π
π Definition
At line 97 of file system_error. yep, that's where she lives. iykyk.
π§ Author π§
Generated automatically by Doxygen for libstdc++ from the source code. not a human author, just robot magic doing its thing. no cap. π€β¨
ok that's the whole page bestie, every flag, every signature, every noexcept β nothing skipped, periodt. π
sign-off szn: this lil beauty came from libstdc++ and is dated Sat Mar 19 2022. go forth and categorize your errors responsibly, mwah π«ΆππΈ
π¦ where this page comes from
- ubuntu jammy: libstdc++-12-doc 12-20220319-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms