In general, the question in the title, I do not know what else to add, except for an example

Overload as a member of a class:

class A { public: int* some_arr; int operator [](uint_t i) { return this->some_arr[i]; } } 

Overload, as I imagine, as not a member of the class:

 class A { // ... public: int* some_arr; // ... } int operator [](const A& a, uint_t i) // либо поменять аргументы местами, поэтому-то и не уверен { return a.some_arr[i]; } 

And if you overload as a non-member of a class, then, it turns out, you need to pass an instance, but first you need to pass an instance, and then an index, or vice versa? Or not at all?

    1 answer 1

    Not:

    16.5.5 Subscripting [over.sub]

    1 operator[] shall be a parameter.