namespace std::meta {
class exception : public std::exception {
public:
consteval exception(std::u8string_view what, info from,
std::source_location where = std::source_location::current()) noexcept;
consteval exception(std::string_view what, info from,
std::source_location where = std::source_location::current()) noexcept;
exception(const exception&) = default;
exception(exception&&) = default;
exception& operator=(const exception&) = default;
exception& operator=(exception&&) = default;
consteval const char* what() const noexcept override;
consteval std::u8string_view u8what() const noexcept;
consteval info from() const noexcept;
consteval std::source_location where() const noexcept;
};
}
概要
exceptionは、リフレクションのメタ関数がエラーを報告するために送出する例外クラスである。std::exceptionから派生する。
定数評価中にのみ送出・捕捉されるため、実行時のオーバーヘッドはない。consteval-only型であり、実行時には存在できない。
メンバ関数
| 名前 | 説明 |
|---|---|
(constructor) |
u8string_viewまたはstring_viewのメッセージ、送出元のリフレクション、ソース位置からオブジェクトを構築する |
what() |
エラーメッセージを通常のエンコーディングで取得 |
u8what() |
エラーメッセージをUTF-8(u8string_view)で取得 |
from() |
送出元のメタ関数のリフレクションを取得 |
where() |
エラーが発生したソース位置を取得 |
バージョン
言語
- C++26
処理系
- Clang: ??
- GCC: 16 (
-freflectionオプション指定) ✅ - Visual C++: ??