[meta.reflection.exception] (original) (raw)

21 Metaprogramming library [meta]

21.4.4 Class exception [meta.reflection.exception]

namespace std::meta { class exception : public std::exception { private: optional<string> what_; u8string u8what_; info from_; source_location where_; public: 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​::​exceptionto 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: Initializes_u8what__ with what,from_ with from, and_where__ 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: Initializes_what__ with what,u8what_ with whattranscoded from the ordinary literal encoding to UTF-8,from_ with from and_where__ with where.

constexpr const char* what() const noexcept override;

Constant When: what_.has_value() is true.

consteval u8string_view u8what() const noexcept;

consteval info from() const noexcept;

consteval source_location where() const noexcept;