C1842: [ incompatible types

[ incompatible types [ERROR]

Description

Binary operator [: There was no global operator defined, which takes the type used.

Example
  struct A {

  
    int j;

  
    int operator [] (A a);

  
  };

  
  void main() {

  
    A a;

  
    int i;

  
    int b[3];

  
    i=a[a];  // ok

  
    i=b[a];  // error

  
  }

  
Tips

Use a type compatible to ì[ì. If there is no global operator for [, take an integer type.