I have two versions of program. First:
template<class T>
void f(T i, T j) = delete;
template<>
void f(int i, int j) {
cout << i << j << endl;
};
int main()
{
f(1.5, 2);
return 0;
}
And second:
template<class T>
void f(T i, T j) = delete;
void f(int i, int j) {
cout << i << j << endl;
};
int main()
{
f(1.5, 2);
return 0;
}
The first version won't compile because 1.5 and 2 have different types. In the second version I removed template<> so 1.5 will be converted to 1 and program will run successfully.
So, when we remove template<>, is it still template specialization, or is it something else? Is there any difference besides implicit type casting? Is it useful?