Would an inline wrapper function solve the problem too? Like the wrapper, only a full-fledged C++ function:
Code:
void func( char *p, int line, char *file ) {
std::cout << p << " at line " << line << " in file " << file << std::endl;
}
inline void inline_wrap( char* a ) {
func( a, __LINE__, __FILE__ );
}
int main( ) {
inline_wrap( "hehe" );
return 0;
}
I'm hoping that since it's inline, __LINE__ and __FILE__ will refer to the point where it's being called in the file, not where I defined it. The obvious answer is I'm going to go check...
EDIT: I just checked, no go. Still reports the line on which func() is called from inline_wrap. The macro solution will be somewhat difficult because this function is a class member template function (i.e., it looks like "some_object_name.alloc<some_type>( params )" ). Thanks for the help though.