C ++中是否有__CLASS__宏? [英] Is there a __CLASS__ macro in C++?

查看:107
本文介绍了C ++中是否有__CLASS__宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C ++中有一个 __ CLASS __ 宏,它给出类似于 __ FUNCTION __ 宏的类名,它给出函数名

Is there a __CLASS__ macro in C++ which gives the class name similar to __FUNCTION__ macro which gives the function name

推荐答案

最近的事情是调用 typeid(your_class).name() -

The closest thing there's is to call typeid(your_class).name() - but this produces compiler specific mangled name.

在类中使用 typeid(* this).name()

这篇关于C ++中是否有__CLASS__宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆