From Jason Turner

[over.sub]

Diff to HTML by rtfpessoa

tmp/tmpo6_rgfb8/{from.md → to.md} RENAMED
@@ -4,30 +4,28 @@
4
 
5
  shall be a non-static member function with exactly one parameter. It
6
  implements the subscripting syntax
7
 
8
  ``` bnf
9
- postfix-expression '[' expression ']'
10
- ```
11
-
12
- or
13
-
14
- ``` bnf
15
- postfix-expression '[' braced-init-list ']'
16
  ```
17
 
18
  Thus, a subscripting expression `x[y]` is interpreted as
19
  `x.operator[](y)` for a class object `x` of type `T` if
20
  `T::operator[](T1)` exists and if the operator is selected as the best
21
  match function by the overload resolution mechanism (
22
  [[over.match.best]]).
23
 
 
 
24
  ``` cpp
25
  struct X {
26
  Z operator[](std::initializer_list<int>);
27
  };
28
  X x;
29
  x[{1,2,3}] = 7; // OK: meaning x.operator[]({1,2,3\)}
30
  int a[10];
31
  a[{1,2,3}] = 7; // error: built-in subscript operator
32
  ```
33
 
 
 
 
4
 
5
  shall be a non-static member function with exactly one parameter. It
6
  implements the subscripting syntax
7
 
8
  ``` bnf
9
+ postfix-expression '[' expr-or-braced-init-list ']'
 
 
 
 
 
 
10
  ```
11
 
12
  Thus, a subscripting expression `x[y]` is interpreted as
13
  `x.operator[](y)` for a class object `x` of type `T` if
14
  `T::operator[](T1)` exists and if the operator is selected as the best
15
  match function by the overload resolution mechanism (
16
  [[over.match.best]]).
17
 
18
+ [*Example 1*:
19
+
20
  ``` cpp
21
  struct X {
22
  Z operator[](std::initializer_list<int>);
23
  };
24
  X x;
25
  x[{1,2,3}] = 7; // OK: meaning x.operator[]({1,2,3\)}
26
  int a[10];
27
  a[{1,2,3}] = 7; // error: built-in subscript operator
28
  ```
29
 
30
+ — *end example*]
31
+