编译器错误 C3218
“type”:类型不允许作为约束
若要使类型成为约束,它必须是值类型或对托管类或接口的引用。
示例
下面的示例生成 C3218。
// C3218.cpp
// compile with: /clr /c
class A {};
ref class B {};
// Delete the following 3 lines to resolve.
generic <class T>
where T : A // C3218
ref class C {};
// OK
generic <class T>
where T : B
ref class D {};