vcruntiem_typeinfo.h
class type_info
{
public:
type_info(type_info const&) = delete;
type_info& operator=(type_info const&) = delete;
size_t hash_code() const throw()
{
return __std_type_info_hash(&_Data);
}
bool operator==(type_info const& _Other) const throw()
{
return __std_type_info_compare(&_Data, &_Other._Data) == 0;
}
bool operator!=(type_info const& _Other) const throw()
{
return __std_type_info_compare(&_Data, &_Other._Data) != 0;
}
bool before(type_info const& _Other) const throw()
{
return __std_type_info_compare(&_Data, &_Other._Data) < 0;
}
char const* name() const throw()
{
#ifdef _M_CEE_PURE
return __std_type_info_name(&_Data, static_cast<__type_info_node*>(__type_info_root_node.ToPointer()));
#else
return __
C++学习(八十三)std的typeid 、type_info
最新推荐文章于 2024-06-30 10:27:31 发布
这篇博客介绍了C++中的typeid运算符和type_info类,用于获取表达式的类型信息。内容涵盖了基本类型和类类型的数据,强调了类型信息在编程语言中的重要性。文章详细阐述了type_info类的特点,包括其私有构造函数、提供的方法,以及typeid运算符的使用场景。还通过示例代码展示了对基本数据类型、无虚函数类和有虚函数类的用法,解释了运行时动态决定类型信息的情况。
摘要由CSDN通过智能技术生成