Say I have implemented a template class like this:
template <size_t N> class C
{
void f()
{
// print out N here?
}
};
I wish that while the compiler compiles a clause like
C<20> c;
it would print out a message
"class C is templated with N = 20"
I've tried with #pragma and static_assert in vain.
The problem is that
- with #pragma and static_assert, I could not embed an integral(20 here) into a message;
- with preprocessors, it's too early that N is not substituted with 20 yet.
Is there any way or no way?
Thanks.