编译器错误 C3231
“arg”: 模板类型参数不能使用泛型类型参数
模板在编译时实例化,而泛型在运行时实例化。 因此,不能生成可调用模板的泛型代码,因为当泛型类型在最后才已知时,模板不能在运行时实例化。
下面的示例生成 C3231:
// C3231.cpp
// compile with: /clr /LD
template <class T> class A;
generic <class T>
ref class C {
void f() {
A<T> a; // C3231
}
};