0
template<int* A,int* B>
void f()
{
}
template<int A,int B>
void f()
{
}
void main()
{
f<(int*)1,(int*)2>();
}
私はテンプレートfinuction f
の2つの特殊化が必要です。しかし、このコードはコンパイルされていません。どうしたの?テンプレート関数(intとint *)の2つの特殊化。コンパイルエラー
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_というエラーはありますか?実際のエラーを表示するには、質問を編集してください。 –