Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC++template metaprogrammingSingle-choice MCQ

Given these three overloads, which is selected for `f(p)` where `p` has type `const int*`, and why?

template<class T> const char* f(T) { return "T"; } template<class T> const char* f(T*) { return "T*"; } template<class T> const char* f(const T*) { return "const T*"; } const int* p = /*...*/; f(p);