注:上课讲的dynamic_cat与这儿的type_info都属于RTII的内容,type_info的内容如下。要注意的是,由于C++标准对于type定义的稍显粗略,故不同编译器可能会所不同。
class
<typeinfo>
std::type_info
class type_info;
Type information type
Stores information about a type.
This type is returned by the typeid
operator (as a const-qualified lvalue). Although the dynamic type may be any class publicly derived from it.
It can be used to compare two types or to retrieve information identifying a type.
typeid
can be applied to any type or typed expressio