Namespaces
Variants

std::meta::exception

From cppreference.com
< cpp | meta
Defined in header <meta>
class exception : public std::exception
(since C++26)

Defines a type of object to be thrown on failure by reflection functions.

Objects of type std::meta::exception can only be created and accessed in constant evaluation.

Member functions

(constructor)
constructs a meta::exception object
(public member function)
what
returns the explanatory string
(public member function)
u8what
returns the explanatory string as a std::u8string_view
(public member function)
from
returns the associated std::meta::info object
(public member function)
where
returns the associated std::source_location
(public member function)

std::meta::exception::exception

consteval exception( std::u8string_view u8what_arg, std::meta::info from,
                     std::source_location where = std::source_location::current() ) noexcept;
(1)
consteval exception( std::string_view what_arg, std::meta::info from,
                     std::source_location where = std::source_location::current() ) noexcept;
(2)
consteval exception( const exception& ) = default;
(3)
consteval exception( exception&& ) = default;
(4)

Constructs a new std::meta::info object. Initializes the stored values with the corresponding parameters.

1) If u8what_arg can be represented in the ordinary literal encoding, the explanatory string returned by what() is u8what_arg transcoded from UTF-8 to the ordinary literal encoding; otherwise, a call to what() is not a constant expression.
2) what_arg must be representable in UTF-8.
3) Copy constructor is defaulted.
4) Move constructor is defaulted.

std::meta::exception::what

constexpr const char* what() const noexcept override;

Returns the explanatory string passed at the time of construction, possibly transcoded from UTF-8 to the ordinary literal encoding.

std::meta::exception::u8what

consteval std::u8string_view u8what() const noexcept;

Returns the explanatory string passed at the time of construction, possibly transcoded from the ordinary literal encoding to UTF-8.

std::meta::exception::from

consteval std::meta::info from() const noexcept;

Returns the std::meta::info value passed at the time of construction.

std::meta::exception::where

consteval std::source_location where() const noexcept;

Returns the std::source_location value passed at the time of construction.

Example