How to find the name of the current function at runtime?

后端 未结 7 792
走了就别回头了
走了就别回头了 2021-01-31 15:17

After years of using the big ugly MFC ASSERT macro, I have finally decided to ditch it and create the ultimate ASSERT macro.

I am fine with getting the file and line num

7条回答
  •  无人及你
    2021-01-31 15:57

    There's no standard solution. However, BOOST_CURRENT_FUNCTION is portable for all practical purposes. The header does not not depend on any of the other Boost headers, so can be used standalone if the overhead of the whole library is unacceptable.

提交回复
热议问题