नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
'declaration' : could not deduce template argument for 'identifier'
Remarks
The compiler cannot determine a template argument. Default arguments cannot be used to deduce a template argument.
Examples
The following example generates C2783:
// C2783.cpp
template<typename T1, typename T2>
T1 f(T2) {
return 248;
}
int main() {
f(1); // C2783
// try the following line instead
int i = f<int>(1);
}
C2783 can also occur when using generics:
// C2783b.cpp
// compile with: /clr
using namespace System;
generic<typename T1, typename T2>
T1 gf(T2) {
T1 t1 = safe_cast<T1>( Activator::CreateInstance(T1::typeid));
return t1;
}
ref class MyClass{};
int main() {
int i;
i = gf(9); // C2783
// OK
i = gf<int>(9);
}