編譯器錯誤 C2395
'your_type::operator'op'' : CLR or WinRT 運算子無效。 至少有一個參數必須是下列類型:'T'、'T%'、'T&'、'T^'、'T^%'、'T^&',其中 T = 'your_type'
Windows 執行階段或 Managed 類型中的運算子沒有至少一個參數,其類型與運算子傳回值的類型相同。
下列範例會產生 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);
};