Multidimensional array operator overloading

Mike Wey mike-wey at example.com
Mon Nov 19 11:25:42 PST 2012


On 11/19/2012 07:04 PM, H. S. Teoh 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]?

This is currently not supported. Would be nice to have tough.

> 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)?

size_t opDollar(int dim)()
{

}

Where dim is the dimension in witch the $ is being used.

> D will totally rock if these features are supported.
>
>
> T
>

-- 
Mike Wey


More information about the Digitalmars-d mailing list