I have a templated function called from several other functions that must record the name of the function from which it was called. Ideally, I want to do something like the following:
template <typename T, const char* CALLER>
void foo(const T& arg) {
}
However, this, of course, does not compile, since it CALLERis an invalid template parameter. Of course, I could just change the signature footo also take the string (caller name) to achieve this.
Question : Is there a preferred C ++ idiomatic way for this kind of thing?
source
share