November 19, 2012 Re: Multidimensional array operator overloading | ||||
---|---|---|---|---|
| ||||
Attachments:
| 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@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. |
Copyright © 1999-2021 by the D Language Foundation