Im currently studying c++ templates and there's something I don't understand. So far I understand if you have the following generic class
template <class T> class A{
...
}
To provide a specific specialization of the class, say for int
objects, you'd define the following:
template<> class A<int>{
...
}
However, I have been seeing cases similar to the following:
Original class is,
template <class T, int Size> class buffer{
...
}
Then the speciliazed class for objects of type int
is,
template <int Size> class buffer<int, Size>{
...
}
I'm confused as why the specilization for int
is not the following:
template<> class bufffer<int, int Size>{
...
}
Can someone please explain.