Compilerfehler C2831

Standardparameter für 'Operator Operator' nicht möglich

Standardparameter sind nur für drei Operatoren zulässig:

  • new

  • Zuweisung =

  • Linke runde Klammer (

Im folgenden Beispiel wird C2831 generiert:

// C2831.cpp
// compile with: /c
#define BINOP <=
class A {
public:
   int i;
   int operator BINOP(int x = 1) {   // C2831
   // try the following line instead
   // int operator BINOP(int x) {
      return i+x;
   }
};