Multidimensional array operator overloading

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Mon Nov 19 11:22:23 PST 2012


AFAIK, no. But you can easily do a[1..2][3..4], which doesn't look too ugly
IMO.


On Mon, Nov 19, 2012 at 10:04 PM, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:

> 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.
>



-- 
Bye,
Gor Gyolchanyan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121119/251ea418/attachment-0001.html>


More information about the Digitalmars-d mailing list