Trying to determine a "modern" implementation for the following C-style code:
#define logError(...) log(__FILE__, __LINE__, __VA_ARGS__)
Is is possible to capture this using variadic templates or something similar that does not rely on a #define
?
Desired use case:
logError( "Oh no! An error occurred!" );
Where __FILE__
, and __LINE__
are captured under the hood, but reflect the file name and line number of where logError
was called from.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…