#include<iostream>
using namespace std;
struct unspecified {};
template< class T_1,class T_2>
struct Demo
{
void print()
{
cout<<"0"<<endl;
}
};
template<class T_2>
struct Demo<unspecified, T_2>
{
void print()
{
cout<<"2"<<endl;
}
};
template<class T_1>
struct Demo<T_1,unspecified >
{
void print()
{
cout<<"1"<<endl;
}
};
int main()
{
Demo<int,char> d;
d.print();
Demo<int,unspecified>d1;
d1.print();
Demo<unspecified,char>d2;
d2.print();
return 0;
}
转载于:https://my.oschina.net/invictuslee/blog/272024