Template specialization vs overloading
What does this print?
#include <iostream>
template<typename T> void f(T) { std::cout << "1"; }
template<> void f(int*) { std::cout << "2"; }
template<typename T> void f(T*) { std::cout << "3"; }
int main() { int* p = nullptr; f(p); }
Sign in to answer questions and track your progress
Sign In