3.7 KiB
[meta.reflection.exception]
21 Metaprogramming library [meta]
21.4 Reflection [meta.reflection]
21.4.4 Class exception [meta.reflection.exception]
namespace std::meta {class exception : public std::exception {private: optional what_; // exposition only u8string u8what_; // exposition only info from_; // exposition only source_location where_; // exposition onlypublic:consteval exception(u8string_view what, info from, source_location where = source_location::current()) noexcept; consteval exception(string_view what, info from, source_location where = source_location::current()) noexcept;
exception(const exception&) = default; exception(exception&&) = default;
exception& operator=(const exception&) = default; exception& operator=(exception&&) = default; constexpr const char* what() const noexcept override; consteval u8string_view u8what() const noexcept; consteval info from() const noexcept; consteval source_location where() const noexcept; };}
Reflection functions throw exceptions of type meta::exception to signal an error.
meta::exception is a consteval-only type.
consteval exception(u8string_view what, info from, source_location where = source_location::current()) noexcept;
Effects: Initializesu8what_ with what,from_ with from, andwhere_ with where.
If what can be represented in the ordinary literal encoding, initializes what_ with what, transcoded from UTF-8 to the ordinary literal encoding.
Otherwise, what_ is value-initialized.
consteval exception(string_view what, info from, source_location where = source_location::current()) noexcept;
Constant When: what designates a sequence of characters that can be encoded in UTF-8.
Effects: Initializeswhat_ with what,u8what_ with what transcoded from the ordinary literal encoding to UTF-8,from_ with from andwhere_ with where.
constexpr const char* what() const noexcept override;
Constant When: what_.has_value() is true.
Returns: what_->c_str().
consteval u8string_view u8what() const noexcept;
Returns: u8what_.
consteval info from() const noexcept;
Returns: from_.
consteval source_location where() const noexcept;
Returns: where_.