You can overload (1) by explicitly specifying the template parameter in square brackets after the function name (see C ++ 11-Standard 14.7.3)
#include <iostream>
using namespace std;
template<class T> void f(T) // (1) base template 1
{
cout << "template<class T> void f(T)" << endl;
}
template<class T> void f(T *) // (2) base template 2
{
cout << "template<class T> void f(T *)" << endl;
}
template<> void f<int*>(int *)
{
cout << "f<int*>(int *)" << endl;
}
int main() {
int i;
f(&i);
return 0;
}