📜  c++ typeid 获取类型名称 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:49.340000             🧑  作者: Mango

代码示例1
const std::type_info& ti1 = typeid(A);
const std::type_info& ti2 = typeid(A);
 
assert(&ti1 == &ti2); // not guaranteed
assert(ti1.hash_code() == ti2.hash_code()); // guaranteed
assert(std::type_index(ti1) == std::type_index(ti2)); // guaranteed