typeid和typeof是c++/gcc编译器的两个关键字,也就是操作符,所以他们根本就不会声明在头文件中。

只不过typeid返回的是type_info,它定义在<typeinfo>头文件中,同时,要使用typeid,就必须先包含该头文件。如下:

This header defines types used related to operators typeid and dynamic_cast.

The inclusion of this header is required prior to any use of the typeid operator.

关于typeid和typeof

可是这还有个问题,为啥vs中,typeid有错误提示呢,如下?

关于typeid和typeof

一直没找到点在哪里,有知道的大神帮忙留个信息。

https://msdn.microsoft.com/zh-cn/library/fyf39xec.aspx

 

相关文章:

  • 2021-12-05
  • 2021-12-20
  • 2021-05-17
  • 2021-08-05
  • 2022-12-23
  • 2021-10-04
猜你喜欢
  • 2022-12-23
  • 2022-01-01
  • 2021-09-24
  • 2021-08-30
  • 2021-08-02
  • 2021-08-22
  • 2021-06-28
相关资源
相似解决方案