std::experiment...optional_access(3cxx)

okay bestie, welcome to the 3cxx manual page for std::experimental::bad_optional_access πŸ’– this is the exception that shows up when you dereference a disengaged optional object. no cap, it’s giving β€œyou tried to access a value that isn’t there” energy.

πŸŽ€ NAME πŸŽ€

  • std::experimental::bad_optional_access β€” Exception class thrown when a disengaged optional object is dereferenced.

✨ SYNOPSIS ✨

#include <optional>

Inherits std::logic_error.

πŸ’… Public Member Functions πŸ’…

  • bad_optional_access (const char *__arg)
  • virtual const char * what () const noexcept

πŸ¦‹ Detailed Description πŸ¦‹

Exception class thrown when a disengaged optional object is dereferenced. that’s the whole plot, bestie: no engaged value, but you dereferenced it anyway, and this class is the icon that catches the fallout πŸ’…


🧚 Member Function Documentation 🧚

🌸 what() β€” virtual, noexcept, inherited 🌸

virtual const char * std::logic_error::what () const [virtual],  [noexcept], [inherited]
  • Returns: a C-style character string describing the general cause of the current error (the same string passed to the ctor).
  • Reimplemented from: std::exception.
  • Reimplemented in: std::future_error.

πŸ‘‘ Author πŸ‘‘

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


xoxo, your libstdc++ docs bestie πŸ’– β€” source/version: libstdc++ (Doxygen-generated), manual: 3cxx; date: not printed on this footer, so I’m not making one up, periodt. 🌈

πŸ“¦ where this page comes from