次の方法で共有


コンパイラ エラー C2784

'declaration' : 'type' のテンプレート引数を 'type' から推測できませんでした。

コンパイラは、指定された関数の引数からテンプレート引数を特定できません。

次の例では、C2784 を生成し、その修正方法を示しています。

// C2784.cpp
template<class T> class X {};
template<class T> void f(X<T>) {}

int main() {
   X<int> x;
   f(1);   // C2784

   // To fix it, try the following line instead
   f(x);
}