Macro to replace C++ operator new

后端 未结 7 1838
臣服心动
臣服心动 2020-12-04 13:47

Is it possible to create macros to replace all forms of operator new with overloads that include additional args...say __FILE__ and __LINE__<

7条回答
  •  悲哀的现实
    2020-12-04 14:14

    What you could do is to overload the operator new and get the stack trace there (platform specific) and use the stack information to deduce from where new was called.

提交回复
热议问题