News for hackers. Stuff that matters.
Re:Fortran is still a thing by xiii1408 on Tuesday November 27, 2018 @09:53PM (#18548905)
There's a better solution, to your problem: pass an "index object" as the argument to operator[].

So `T& operator[](index_t)`, where `index_t` could just be a tuple.

  a[{1, 2}] = 12;
This has virtually the same syntax, will be compiled in the same way by any modern compiler, and lets you create special index types that have invariants (suppose you want i0 < i1).
Re:Fortran is still a thing by beojan on Wednesday November 28, 2018 @01:11AM (#18549615)
That's not a "better solution", it's a workaround.
Re:Fortran is still a thing by kitd on Wednesday November 28, 2018 @04:13AM (#18550231)
I disagree. The tuple is an index into an array. The multiplicity of the tuple indicates (literally, in fact) the multiple dimensions of the array. Ie to the coder, it is the index that takes on the multi-dimensionality, not the array.