#include <iostream>
#include <vector>
#include <string>
using namespace std;
template<typename T,typename U>
struct test
{
test()
{
cout << "泛化" << endl;
}
};
template<typename T>
struct test<T,T>
{
test()
{
cout << "数量上的偏特化" << endl;
}
};
template<typename T, typename U>
struct test<T*, U*>
{
test()
{
cout << "范围上的偏特化" << endl;
}
};
int main()
{
int a = 1, b = 2;
test<int, int> t1;
test<int, double> t2;
test<int*, double*> t3;
return 0;
}
调用结果如下图