How can I see the type deduced for a template type parameter?
Is there an easy way to force compilers to show me the type deduced for a
template parameter? For example, given
template<typename T>
void f(T&& parameter);
const volatile int * const pInt = nullptr;
f(pInt);
I might want to see what type is deduced for T in the call to f. (I think
it's const volatile int *&, but I'm not sure.) Or given
template<typename T>
void f(T parameter);
int numbers[] = { 5, 4, 3, 2, 1 };
f(numbers);
I might want to find out if my guess that T is deduced to be int* in the
call to f is correct.
If there's a third-party library solution (e.g., from Boost), I'd be
interested to know about it, but I'd also like to know if there's an easy
way to force a compilation diagnostic that would include the deduced type.
No comments:
Post a Comment