Is it ever possible to get the current (member) function name in C++?

前端 未结 4 1039
深忆病人
深忆病人 2020-12-21 04:13

I don’t know much about RTTI, but I believe that thanks to that you can retrieve the name of variables at run-time. Is it possible to retrieve the name of the function the

4条回答
  •  渐次进展
    2020-12-21 05:01

    C++11 standardized __func__ for the current function.

    Various compilers support variations of __FUNCTION__, __PRETTY_FUNCTION__, and others.

提交回复
热议问题