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 default error_condition for the int __i. it's noexcept, so no drama.
  • virtual bool equivalent (const error_code &__code, int __i) const noexcept β€” checks if __code and the int __i are equivalent. noexcept, obviously.
  • virtual bool equivalent (int __i, const error_condition &__cond) const noexcept β€” same energy, but the other way around: int __i vs. the error_condition __cond. also noexcept.
  • 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 a const char *, and it's noexcept.
  • 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