I've been trying to understand template specializations. Why is this generating an error (specialization of 'T foo(T, T) [with T = int]' after instantiation
)
template <class T> T foo(T a, T b);
int main()
{
int x=34, y=54;
cout<<foo(x, y);
}
template <class T> T foo(T a, T b)
{
return a+b;
}
template <> int foo<int>(int a, int b)
{
cout<<"int specialization";
}