C++ typeid

CC++的typeid

注意:typeid是操作符,不是函数!)
运行时获知变量类型名称,可以使用 typeid(变量).name(),需要注意不是所有编译器都输出"int"、"float"等之类的名称,对于这类的编译器可以这样使用:float f = 1.1f; if( typeid(f) == typeid(0.0f) )





原文地址:https://www.cnblogs.com/fengkang1008/p/4652209.html