On Fri, 24 Feb 2006 12:23:29 -0800, Plissken.s wrote:
Hi,
If I define a template wich uses the __FILE__ marco in a .h file
and I have class which creates/uses that template (in a .cpp file).
What will the __FILE__ marco expand to? the .h which defines the
template? or the .cpp file which uses the template?
Thank you.
Taking a wild guess here, you might want to try this:
#define WhereMacro \
cerr << __FILE__ << ": line: " << __LINE__ << ": " << __FUNCTION__ <<endl
in some header file, then call
WhereMacro;
anywhere in your code, and it all will expand to what you expect.
This is one instance where you have to use a #define, rather than an
inline function.