在入门C++过程中,我们经常会遇到无法判断对象类型的情况。

头文件( VS编译器 )

#include <typeinfo>

typeid(对象).name();

例子:

    const int a = , &b = a;
auto e = a;
auto d = b;
MyClass c;
MyStruct s;
cout << typeid(a).name() << endl; // int
cout << typeid(&b).name() << endl;// int const *
cout << typeid(e).name() << endl; // int
cout << typeid(d).name() << endl; // int
cout << typeid(c).name() << endl; // class MyClass
cout << typeid(s).name() << endl; // Struct MyStruct

最新文章

  1. Android ViewPager 用法
  2. [转]Linux df 命令不更新磁盘数据空间使用情况的解决办法
  3. pycharm active code
  4. Win7下同时使用有线和无线时的优先级设置
  5. sql存在一个表而不在另一个表中的数据
  6. mtu
  7. javascript实现ajax
  8. FFmpeg资料来源简单分析:libswscale的sws_getContext()
  9. OPENWRT make menuconfig错误之一
  10. Python 多线程进程高级指南(二)
  11. Django 缓存模块 page_cache 源码阅读
  12. nginx系列8:反向代理和负载均衡原理
  13. 洛谷P4092 [HEOI2016/TJOI2016]树 并查集/树链剖分+线段树
  14. [C#学习笔记]你真的理解拆箱装箱吗?
  15. A - 确定比赛名次(拓扑)
  16. BZOJ1975 SDOI2010魔法猪学院
  17. 设置使用的python版本
  18. 用Python 3写的一个Spider小爬虫(使用内置urllib模块and正则表达式)
  19. hdu5985[概率dp] 2016青岛icpc现场赛
  20. java在线聊天项目1.3版设计好友列表框功能补充,因只要用户登录就发送一串新列表,导致不同客户端好友列表不同问题

热门文章

  1. java如何获取项目的工作目录
  2. QML小例子【QML工程里信号与槽】
  3. Linux -- Reactor
  4. ORM连表操作
  5. iOS-self.用法
  6. Nginx+keepalived 高可用双机热备(主从模式/双主模式)
  7. todolist形式的搜索框,分开组件写的,点击上下键时,框内显示当前选中的内容
  8. &#128293;Scratch少儿编程——飞机大战
  9. (CVE-2016-5195)脏牛本地提权
  10. 创建SSH密钥