Multidimensional array operator overloading

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Nov 19 10:04:47 PST 2012


I'm experimenting with implementing "true" multidimensional arrays in D.
It's actually very nice, compared with the hassle of memory management
in C/C++, and it even lets you give opIndex multiple parameters so that
you can write things like arr[1,2] instead of the uglier arr[1][2] (or
worse, arr[2][1]).

Two questions, though:

1) Is multidimensional slicing supported? I.e., does opSlice support
notation like arr[1..2, 2..3]?

2) Is opDollar supported for multidimensional arrays? I.e., when you
write arr[1..$, 2..$], the $ in each dimension can potentially be
different values (say you have a 2x3 array, so the first $ is 2, and the
second $ is 3)?

D will totally rock if these features are supported.


T

-- 
Today's society is one of specialization: as you grow, you learn more
and more about less and less. Eventually, you know everything about
nothing.


More information about the Digitalmars-d mailing list