std::meta::exception
来自cppreference.com
| 在标头 <meta> 定义
|
||
| |
(C++26 起) | |
定义一种对象类型,供反射函数在失败时抛出。
std::meta::exception 类型的对象只能在常量求值中创建和访问。
成员函数
(构造函数) |
构造一个 meta::exception 对象 (公开成员函数) |
what |
返回解释性字符串 (公开成员函数) |
u8what |
以 std::u8string_view 的形式返回解释性字符串 (公开成员函数) |
from |
返回关联的 std::meta::info 对象 (公开成员函数) |
where |
返回关联的 std::source_location (公开成员函数) |
std::meta::exception::exception
| |
(1) | |
| |
(2) | |
| |
(3) | |
| |
(4) | |
构造一个新的 std::meta::info 对象。用相应的形参初始化存储的值。
1) 如果
u8what_arg 能用普通字面量编码表示,那么 what() 返回的解释性字符串是将 u8what_arg 从 UTF-8 转码到普通字面量编码的结果;否则,对 what() 的调用不是常量表达式。2)
what_arg 必须能用 UTF-8 表示。3) 复制构造函数为预置的。
4) 移动构造函数为预置的。
std::meta::exception::what
| |
||
返回构造时传入的解释性字符串,可能已从 UTF-8 转码到普通字面量编码。
std::meta::exception::u8what
| |
||
返回构造时传入的解释性字符串,可能已从普通字面量编码转码到 UTF-8。
std::meta::exception::from
| |
||
返回构造时传入的 std::meta::info 值。
std::meta::exception::where
| |
||
返回构造时传入的 std::source_location 值。
示例
| 本节未完成 原因:暂无示例 |