Capture __LINE__ and __FILE__ without #define

前端 未结 2 812
生来不讨喜
生来不讨喜 2020-12-07 01:02

Trying to determine a \"modern\" implementation for the following C-style code:

#define logError(...) log(__FILE__, __LINE__, __VA_ARGS__)

2条回答
  •  [愿得一人]
    2020-12-07 01:52

    Macros are indeed your only choice, at least until std::source_location makes it into the standard and fulfills your wish.

提交回复
热议问题