std::runtime_error(3cxx)

πŸ’– std::runtime_error πŸ’–

okay so welcome to the std::runtime_error(3cxx) page, bestie β€” manual name folded in right at the top so we don't have to copy the header line like a boring person. this is the group chat briefing on std::runtime_error, and she is one of two subclasses of exception. periodt. πŸ’…

🌸 NAME 🌸

std::runtime_error β€” one of two subclasses of exception. lowkey that's the whole name vibe, no cap.

✨ SYNOPSIS ✨

first, the include, because we love a literal:

#include <stdexcept>

she inherits std::exception.

the iconiques that inherit from her are:

  • std::chrono::ambiguous_local_time
  • std::chrono::nonexistent_local_time
  • std::overflow_error
  • std::range_error
  • std::regex_error
  • std::system_error
  • std::underflow_error

🫢 Public Member Functions 🫢

  • runtime_error (const char *) _GLIBCXX_TXN_SAFE β€” the const char * ctor, with _GLIBCXX_TXN_SAFE kept exactly where it belongs. don't drop it, iykyk. 🫢
  • runtime_error (const runtime_error &)=default β€” copy ctor, defaulted. slay.
  • runtime_error (const string &__arg) _GLIBCXX_TXN_SAFE β€” the const string &__arg ctor, also carrying _GLIBCXX_TXN_SAFE. yes bestie, both underscores in __arg matter. 😭
  • runtime_error (runtime_error &&) noexcept β€” move ctor, and she's noexcept. iconic.
  • runtime_error & operator= (const runtime_error &)=default β€” copy assignment, defaulted.
  • runtime_error & operator= (runtime_error &&) noexcept β€” move assignment, noexcept. periodt.
  • virtual const char * what () const noexcept β€” the virtual what() that's const noexcept; main character energy for error messages. πŸ‘‘

πŸ’« Detailed Description πŸ’«

okay so the detailed tea is the same as the NAME: std::runtime_error is one of two subclasses of exception.

runtime errors are the problems that sit outside a program's scope β€” you can't easily predict them, and generally the only time you can catch them is while the program is actually executing. that's the lore, bestie. no extra spice added. 😭

πŸŽ€ Constructor & Destructor Documentation πŸŽ€

πŸ“ std::runtime_error::runtime_error (const string & __arg) [explicit] πŸ“

takes a character string describing the error. that's it, that's the constructor. she's explicit and she ate. πŸ’…

πŸ’… Member Function Documentation πŸ’…

⭐ virtual const char * std::runtime_error::what () const [virtual], [noexcept] ⭐

returns a C-style character string describing the general cause of the current error (the same string passed to the ctor). no cap, it's literally the same string.

reimplemented from std::exception.

reimplemented in std::filesystem::filesystem_error, and std::experimental::filesystem::v1::filesystem_error. those are the iconiques who override her. πŸ‘‘

πŸ‘‘ Author πŸ‘‘

ngl, the "author" is Doxygen: this page was generated automatically by Doxygen for libstdc++ from the source code. not me, not you, not the group chat. πŸ’€


k bye bestie! source/version: libstdc++; date: not printed on the footer, so I'm not inventing one; page: std::runtime_error(3cxx). stay iconic and don't forget the _GLIBCXX_TXN_SAFE bestie πŸ’–βœ¨

πŸ“¦ where this page comes from