类型的名称
你可以使用 typeid
返回的 std::type_info
对象的 .name()
成员函数在运行时检索实现定义的类型名称。
#include <iostream>
#include <typeinfo>
int main()
{
int speed = 110;
std::cout << typeid(speed).name() << '\n';
}
输出(实现定义):
int
你可以使用 typeid
返回的 std::type_info
对象的 .name()
成员函数在运行时检索实现定义的类型名称。
#include <iostream>
#include <typeinfo>
int main()
{
int speed = 110;
std::cout << typeid(speed).name() << '\n';
}
输出(实现定义):
int