Files
2025-10-25 03:02:53 +03:00

3.7 KiB
Raw Permalink Blame History

[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; };}

1

#

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;

2

#

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;

3

#

Constant When: what designates a sequence of characters that can be encoded in UTF-8.

4

#

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;

5

#

Constant When: what_.has_value() is true.

6

#

Returns: what_->c_str().

🔗

consteval u8string_view u8what() const noexcept;

7

#

Returns: u8what_.

🔗

consteval info from() const noexcept;

8

#

Returns: from_.

🔗

consteval source_location where() const noexcept;

9

#

Returns: where_.