#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
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/281067.html