Similar to what __FUNCTION__ does for the current function, Is there a preprocessor macro to get the name of the current class?
Asked
Active
Viewed 2.3k times
14
Brian Tompsett - 汤莱恩
- 5,438
- 68
- 55
- 126
Damian
- 5,391
- 10
- 54
- 87
-
What for? There may be other ways. – GManNickG Mar 25 '11 at 00:08
-
Look at [https://stackoverflow.com/questions/1666802/class-macro-in-c](https://stackoverflow.com/questions/1666802/class-macro-in-c) – Adam Trhon Mar 25 '11 at 00:06
1 Answers
2
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.
Alexander Gessler
- 44,353
- 6
- 80
- 121