template instanciation is when you give a to a template class a template parameter.
Like:
Code:
std::vector<string> v;
v is an instanciation of a template.
Specialization is more complex but let me try to explain it simply.
Code:
template<class T>
class vector { }; //base template
template<class T>
class vector<T *> //partial specialization
{ };
template<>
class vector<string> //complete specialization
{ };
The compiler will choose each implentation is the better one regarding the template paramameters. Each specialization is a complete distinct class from the the base template. But this allows optimization and/or custom behaviour regarding different type using the same syntax.
Code:
vector<int> vi; //defaut template is used
vector<int *> vip; //vector<T*> is used
vector<string> vs; //vector<string> is used
this offers lots of room for optimization, but for a vector user it is always a vector that is used.
Comment