std::error_code(3cxx)

std::error_code πŸ’… (from the 3cxx manual, libstdc++ edition)

okay bestie, welcome to std::error_code β€” it's giving main character energy in the 3cxx manual, and we're gonna get through every signature together 🫢✨

πŸ’– NAME πŸ’–

std::error_code β€” that's the name, no cap.

✨ SYNOPSIS ✨

#include <system_error>

🫢 Public Member Functions 🫢

  • template<typename _ErrorCodeEnum , typename = _Check<_ErrorCodeEnum>> error_code (_ErrorCodeEnum __e) noexcept β€” Initialize with a user-defined type, by calling make_error_code.
  • error_code (const error_code &)=default β€” defaulted, periodt.
  • error_code (int __v, const error_category &__cat) noexcept β€” constructor with __v and __cat, exactly like the signature says.
  • void assign (int __v, const error_category &__cat) noexcept β€” assign time, bestie.
  • const error_category & category () const noexcept β€” The error category that this error belongs to.
  • void clear () noexcept β€” clear it out, that's the whole signature.
  • error_condition default_error_condition () const noexcept β€” An error_condition for this error's category and value.
  • string message () const β€” The category's description of the value.
  • operator bool () const noexcept β€” Test whether value() is non-zero.
  • error_code & operator= (const error_code &)=default β€” defaulted assignment vibe.
  • int value () const noexcept β€” The error value.
Note that these are not member symbols. iykyk 🫢
  • error_code make_error_code (errc __e) noexcept β€” related symbol, not a member, obviously.
  • strong_ordering operator (const error_code &__lhs, const error_code &__rhs) noexcept β€” related symbol, not a member.
  • template<typename _CharT , typename _Traits > basic_ostream< _CharT, _Traits > & operator<< (basic_ostream< _CharT, _Traits > &__os, const error_code &__e) β€” related symbol, not a member.

πŸ¦‹ Detailed Description πŸ¦‹

πŸͺ© Class error_code πŸͺ©

Okay so error_code is a value type storing an integer error number and a category that gives meaning to the error number. Typically this is done close the the point where the error happens, to capture the original error value. (yes, I kept the double β€œthe the” exactly β€” character-for-character energy πŸ’…)

An error_code object can be used to store the original error value emitted by some subsystem, with a category relevant to the subsystem. For example, errors from POSIX library functions can be represented by an errno value and the 'generic' category, but errors from an HTTP library might be represented by an HTTP response status code (e.g. 404) and a custom category defined by the library.

⭐ Since ⭐

C++11 β€” the era, the moment, the standard, bestie.

🧚 Constructor & Destructor Documentation 🧚

  • template<typename _ErrorCodeEnum , typename = _Check<_ErrorCodeEnum>> std::error_code::error_code (_ErrorCodeEnum __e) [inline], [noexcept] β€” Initialize with a user-defined type, by calling make_error_code.
    • References make_error_code().

🌈 Member Function Documentation 🌈

  • const error_category & std::error_code::category () const [inline], [noexcept] β€” The error category that this error belongs to.
    • Referenced by message().
  • error_condition std::error_code::default_error_condition () const [noexcept] β€” An error_condition for this error's category and value.
  • string std::error_code::message () const [inline] β€” The category's description of the value.
    • References category(), and value().
  • std::error_code::operator bool () const [inline], [explicit], [noexcept] β€” Test whether value() is non-zero.
  • int std::error_code::value () const [inline], [noexcept] β€” The error value.
    • Referenced by message().

πŸ‘‘ Author πŸ‘‘

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


okay that's the whole page, bestie! πŸ’– The footer energy is source/version libstdc++ and page std::error_code(3cxx); there's no date printed in the footer text here, so I'm not inventing one β€” periodt 🫢✨

πŸ“¦ where this page comes from