std::bad_cast(3cxx)

okay bestie, welcome to std::bad_cast from the <purple>3cxx</purple> manual β€” she’s the exception you meet when a typecast goes wrong, and she has main character energy πŸ’…βœ¨

πŸ’– NAME πŸ’–

std::bad_cast β€” thrown during incorrect typecasting. That’s the whole vibe: bad cast, bad time, exception said β€œnot today” 😭

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <typeinfo>
  • Inherits std::exception.
  • Inherited by std::experimental::fundamentals_v1::bad_any_cast.

✨ Public Member Functions ✨

  • virtual const char * what () const noexcept β€” the public member function signature, exactly as listed, bestie.

🌸 Detailed Description 🌸

Okay so thrown during incorrect typecasting β€” yes, again, because that’s literally her job πŸ’…

If you attempt an invalid dynamic_cast expression, an instance of this class (or something derived from this class) is thrown. So like, if the cast is not casting correctly, boom: that’s the throw, no cap 😭

πŸŽ€ Member Function Documentation πŸŽ€

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

This one returns a C-style character string describing the general cause of the current error. That’s the whole assignment: what() gives you the general cause, bestie.

  • Reimplemented from std::exception.
  • Reimplemented in std::experimental::fundamentals_v1::bad_any_cast.

πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. So nobody hand-wrote this baddie; Doxygen did the thing ✨


that’s the page, bestie! Shoutout to libstdc++ for the source/version and to std::bad_cast(3cxx) for the manual page name β€” the original footer has no date, so I’m not inventing one πŸ™ˆπŸ’œ

πŸ“¦ where this page comes from