I am trying to understand the concept of partial specialization of templates. However I seem to be confusing it with template specialization. I am considering the following two examples
template <typename T>
struct test
{
///Some stuff
};
template <> //Specialization
struct test<int*>
{
///Some stuff
};
template<typename t> //Partial specialization
struct test<t*>
{
///Some stuff
};
I am trying the following
test<int*> s;
and this calls the specialized template. How can i call the partially specialized class. Could anyone please also explain the difference between partial and specialized template with an example ?
Update:
After going through the answers I realized that partial template specialization assists only when a subset of the parameters need to be specialized. So I tried something like this
template <>
struct test<int*>
{
};
//Partial Specialized
template<typename t>
struct test<t, std::string>
{
};
test<int*,std::string> s; //Error : Too many arguments for class template
Why is that ?