编译器错误 C2395
“your_type::operator'op'”:CLR 或 WinRT 运算符无效。 至少一个参数必须是以下类型:“T”、“T%”、“T&”、“T^”、“T^%”、“T^&”,其中 T =“your_type”
Windows 运行时或托管的类型中的一个运算符没有至少一个类型与运算符返回值的类型相同的参数。
下面的示例生成 C2395,并演示如何修复此错误:
// C2395.cpp
// compile with: /clr /c
value struct V {
static V operator *(int i, char c); // C2395
// OK
static V operator *(V v, char c);
// or
static V operator *(int i, V& rv);
};