Operator[][] overload

前端 未结 18 1866
轮回少年
轮回少年 2020-11-22 05:46

Is it possible to overload [] operator twice? To allow, something like this: function[3][3](like in a two dimensional array).

If it is pos

18条回答
  •  误落风尘
    2020-11-22 06:24

    For a two dimensional array, specifically, you might get away with a single operator[] overload that returns a pointer to the first element of each row.

    Then you can use the built-in indexing operator to access each element within the row.

提交回复
热议问题