#include <iostream>
#include <boost/type.hpp>
class A
{
};
struct B
{
};
void test_typeid()
{
using namespace boost;
char a;
std::cout << typeid(a).name() << std::endl;
int b;
std::cout << typeid(b).name() << std::endl;
unsigned short c;
std::cout << typeid(c).name() << std::endl;
char* d;
std::cout << typeid(d).name() << std::endl;
//由于string 是模版,这里直接输出std::string的模版原型
std::string e;
std::cout << typeid(e).name() << std::endl;
A f;
std::cout << typeid(f).name() << std::endl;
B g;
std::cout << typeid(g).name() << std::endl;
}
int main(int argc, char* argv[])
{
test_typeid();
system("pause");
return 0;
}
输出: