下面的模板特码:C++函数模板特殊化: “非法使用显式模板参数”
template<typename T1, typename T2>
void spec1()
{
}
测试案例1:
template< typename T1> //compile error
void spec1<int>()
{
}
测试案例2:
template< typename T2> //compile error
void spec1<int>()
{
}
生成以下编译错误:
error C2768: 'spec1' : illegal use of explicit template arguments
有谁知道为什么?
你在使用什么平台/编译器? – aaa90210 2009-09-12 22:57:03
我正在使用Visual C++ 08 – jameszhao00 2009-09-13 01:23:45