Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preprocessor macro to get the name of the current class? [duplicate]

Similar to what __FUNCTION__ does for the current function, Is there a preprocessor macro to get the name of the current class?

like image 597
Damian Avatar asked Mar 25 '11 00:03

Damian


1 Answers

No, there is no such macro - sorry.

But nevertheless: __FUNCTION__ (or __PRETTY_FUNCTION__ with gcc) should give you the name of the enclosing class - you just have to extract it.

like image 151
Alexander Gessler Avatar answered Nov 07 '22 06:11

Alexander Gessler