22 General utilities library [utilities] (original) (raw)
22.8 Expected objects [expected]
22.8.4 Class template bad_expected_access [expected.bad]
namespace std { template<class E> class bad_expected_access : public bad_expected_access<void> { public: constexpr explicit bad_expected_access(E);constexpr const char* what() const noexcept override;constexpr E& error() & noexcept;constexpr const E& error() const & noexcept;constexpr E&& error() && noexcept;constexpr const E&& error() const && noexcept;private: E unex; };}
The class template bad_expected_accessdefines the type of objects thrown as exceptions to report the situation where an attempt is made to access the value of an expected<T, E> object for which has_value() is false.
constexpr explicit bad_expected_access(E e);
Effects: Initializes unex with std::move(e).
constexpr const E& error() const & noexcept;constexpr E& error() & noexcept;
constexpr E&& error() && noexcept;constexpr const E&& error() const && noexcept;
Returns: std::move(unex).
constexpr const char* what() const noexcept override;
Returns: An implementation-defined ntbs, which during constant evaluation is encoded with the ordinary literal encoding ([lex.ccon]).