[over.sub] (original) (raw)
12 Overloading [over]
12.4 Overloaded operators [over.oper]
12.4.5 Subscripting [over.sub]
A subscripting operator functionis a member function named operator[]with an arbitrary number of parameters.
It may have default arguments.
For an expression of the form
the operator function is selected by overload resolution ([over.match.oper]).
If a member function is selected, the expression is interpreted as
[Example 1: struct X { Z operator[](std::initializer_list<int>); Z operator[](auto...);}; X x; x[{1,2,3}] = 7; x[1,2,3] = 7; int a[10]; a[{1,2,3}] = 7; a[1,2,3] = 7; — _end example_]