std::type_index::name
来自 cppreference.cn
< cpp | types | type index
const char* name() const noexcept; |
(自 C++11 起) | |
返回关联的 std::type_info 对象的名称。 等效于直接调用 std::type_info::name()。
目录 |
[edit] 参数
(无)
[edit] 返回值
关联的 std::type_info 对象的名称。
[edit] 示例
运行此代码
#include <iostream> #include <typeindex> int main() { std::cout << std::type_index(typeid(std::cout)).name(); }
可能的输出
NSt3__113basic_ostreamIcNS_11char_traitsIcEEEE
[edit] 缺陷报告
以下行为变更缺陷报告被追溯应用于先前发布的 C++ 标准。
DR | 应用于 | 已发布行为 | 正确行为 |
---|---|---|---|
LWG 2144 | C++11 | type_index::name 未被要求为 noexcept |
要求 |