multidim-subscript.cxx 231 B

1234567891011121314
  1. // Test for multidimensional subscript operator support.
  2. // Proposed for C++23: P2128R6.
  3. struct table
  4. {
  5. int width = 100;
  6. int operator[](int x, int y) const { return x + width * y; }
  7. };
  8. int main()
  9. {
  10. return table{}[0, 0];
  11. }