0
template<int* A,int* B>
void f()
{
}
template<int A,int B>
void f()
{
}
void main()
{
f<(int*)1,(int*)2>();
}
我想要我的模板finjing f
两个specializtions。但是这个代码没有编译。有什么问题?模板函数的两个特化(int和int *)。编译错误
Error 1 error C2440: "specialization" : cannot convert from "int *" to "const int" line 11
Error 2 error C2973: invalid template argument "int *" line 11
Error 3 error C2440: "specialization" : cannot convert from "int *" to "const int" line 11
Error 4 error C2973: invalid template argument "int *" line 11
Error 5 error C2668: 'f' : ambiguous call to overloaded function line 11
编译器的Visual C++ 2010
好的,你会得到错误,但_what_错误?请修改您的问题以显示实际错误。 – 2012-01-13 07:07:59