1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #ifndef __CNAME_H__ #define __CNAME_H__ #include <string> inline std::string className(const std::string& prettyFunction) { size_t colons = prettyFunction.find("::"); if (colons == std::string::npos) return "::"; size_t begin = prettyFunction.find_last_of("::") + 1; return prettyFunction.substr(begin); } #ifdef __GNUC__ #define __CLASS_NAME__ className(__PRETTY_FUNCTION__) #define __FUNCNAME__ __PRETTY_FUNCTION__ #else #define __CLASS_NAME__ className(__FUNCTION__) #define __FUNCNAME__ __FUNCTION__ #endif #endif |
Thursday, May 10, 2018
How to print ClassName
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment