std::bad_expected_access(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

okay so welcome to the C++ Standard Libary page for std::bad_expected_access(3) β€” yes bestie, that manual-name spelling is canon, we keep it πŸ’…. The name line is literally:

std::bad_expected_access β€” std::bad_expected_access


✨ Synopsis ✨

Defined in header <expected>
template< class E >                                               (1)
(since C++23)
class bad_expected_access : public std::bad_expected_access<void>
template<>                                                        (2)
(since C++23)
class bad_expected_access<void> : public std::exception

Here’s the tea, bestie:

  1. (1) defines a type of object to be thrown by std::expected::value when accessing an expected object that contains an unexpected value. bad_expected_access<E> stores a copy of the unexpected value. 🫢
  2. (2) bad_expected_access<void> is the base class of all other bad_expected_access specializations. πŸ‘‘
🚧 This section is incomplete β€” Reason: inheritance diagram.

🌸 Parameters 🌸

(none) β€” literally no parameters, periodt πŸ’…


πŸ”₯ Return value πŸ”₯

Pointer to a null-terminated string with explanatory information. The string is suitable for conversion and display as a std::wstring. The pointer is guaranteed to be valid at least until the exception object from which it is obtained is destroyed, or until a non-const member function (e.g. copy assignment operator) on the exception object is called.


πŸ¦‹ Notes πŸ¦‹

Implementations are allowed but not required to override what(). no cap.

πŸ’œ Members of the bad_expected_access<void> specialization

  • constructor β€” constructs a bad_expected_access<void> object (protected member function).
  • destructor β€” destroys the bad_expected_access<void> object (protected member function).
  • operator= β€” replaces the bad_expected_access<void> object (protected member function).
  • what β€” returns the explanatory string (public member function).

Special member functions of bad_expected_access<void> are protected. They can only be called by derived classes. πŸ‘‘


πŸŽ€ Example πŸŽ€

😭 This section is incomplete β€” Reason: no example.

🏷️ Categories 🏷️

  • Todo with reason
  • Todo no example

source/version: http://cppreference.com Β· date: 2024.06.10 Β· page: std::bad_expected_access(3) β€” mwah, bestie πŸ’‹βœ¨

πŸ“¦ where this page comes from