#include <iostream>
#include <typeinfo>
int main()
{
int i;
const std::type_info &info = typeid(int);
std::cout << "typeid " << info.name() << std::endl;
if(info == typeid(i));
{
std::cout << "do something" << std::endl;
}
return 0;
}
$ ./a.out
typeid i
do something
标签:std,typeid,类型信息,int,C++,info
From: https://www.cnblogs.com/zhangxuechao/p/16593669.html