#include<iostream>
using namespace std;
template<class T>
struct CTest{
void operator()(){cout<<"CTest<T>/n";}
};
template<>
struct CTest<char>{
void operator()(){cout<<"CTest<char>/n";}
};
template<>
struct CTest<int>{
void operator()(){cout<<"CTest<int>/n";}
};
int main()
{
CTest<double> test1;
CTest<int> test2;
CTest<char> test3;
test1();
test2();
test3();
return 0;
}
运行输出:
CTest<T>
CTest<int>
CTest<char>