且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是否有类名宏?

更新时间:2023-12-01 07:49:39

Peng Yu写道:




__PRETTY_FUNCTION__是一个给出函数名称的宏等等



是吗?


我是

想知道是否有一个宏来获取成员中的类名

函数。



不在标准C ++中。


-

Ian Collins。


9月15日晚上8:24,Ian Collins< ian- n ... @ hotmail.comwrote:

Peng Yu写道:



__PRETTY_FUNCTION__是一个给出函数名称等的宏。



是吗?


我是

想知道是否有一个宏来获取成员内的类名

函数。



不在标准C ++中。



我知道__PRETTY_FUNCTION__不在标准中。但标准

有类似的东西,我只记得它是什么。但我的

问题是关于班级名称的。


谢谢,




Peng Yu写道:

9月15日晚上8:24,Ian Collins< ian-n ... @ hotmail .comwrote:

> Peng Yu写道:



__PRETTY_FUNCTION__是一个给出函数名称等的宏。


是吗?


我是

想知道是否有一个宏来获取成员内的类名

函数。


不在标准C ++中。



我知道__PRETTY_FUNCTION__不在标准范围内。但标准

有类似的东西,我只记得它是什么。



标准有以下预定义的宏[16.8]:


__LINE__

__FILE __

__DATE__

__TIME__

__STDC__

__cplusplus__


其他一切都是具体实现。


但我的问题是关于班级名称。



您的问题已得到解答:不在标准C ++中。

***
>
Kai-Uwe Bux


Hi,

__PRETTY_FUNCTION__ is a macro that gives function name, etc. I''m
wondering if there is a macro to get the class name inside a member
function.

Thanks,
Peng

Peng Yu wrote:
Hi,

__PRETTY_FUNCTION__ is a macro that gives function name, etc.

Is it?

I''m
wondering if there is a macro to get the class name inside a member
function.

Not in standard C++.

--
Ian Collins.


On Sep 15, 8:24 pm, Ian Collins <ian-n...@hotmail.comwrote:
Peng Yu wrote:
Hi,

__PRETTY_FUNCTION__ is a macro that gives function name, etc.


Is it?

I''m
wondering if there is a macro to get the class name inside a member
function.


Not in standard C++.

I know __PRETTY_FUNCTION__ is not in the standard. But the standard
has something similar to it, I just do remember what it is. But my
questions was on the class name.

Thanks,
Peng


Peng Yu wrote:
On Sep 15, 8:24 pm, Ian Collins <ian-n...@hotmail.comwrote:
>Peng Yu wrote:
Hi,

__PRETTY_FUNCTION__ is a macro that gives function name, etc.


Is it?

I''m
wondering if there is a macro to get the class name inside a member
function.


Not in standard C++.


I know __PRETTY_FUNCTION__ is not in the standard. But the standard
has something similar to it, I just do remember what it is.

The standard has the following predefined macros [16.8]:

__LINE__
__FILE__
__DATE__
__TIME__
__STDC__
__cplusplus__

Everything else is implementation specific.

But my questions was on the class name.

And your question has been answered: "not in standard C++".
Best

Kai-Uwe Bux