1、判断类型是否相等
int A = 1; int B = 2; float C = 3.f; std::cout << typeid(A) == typeid(B) << " " << typeid(B) == typeid(C) << std::endl;
2、输出数据的类型名
class Test {}; int A = 1; float B = 3.f; Test C; std::cout << "A type:" << typeid(A).name() << ", B type:" << typeid(B).name() << ", C type" << typeid(C).name() << std::endl;