次の方法で共有


コンパイラ エラー 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);
}