multi-dimensional array whole slicing
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Apr 23 02:06:35 PDT 2017
On 04/22/2017 01:51 PM, XavierAP wrote:
> I can do:
>
> int[3] arr = void;
> arr[] = 1;
>
> But apparently I can't do:
>
> int[3][4] arr = void;
> arr[][] = 1;
>
> What is the best way? What am I missing?
It took me a while to convince myself that there is no bug here. The
problem, as is obvious to others, ;) a whole slice of a whole slice is
still the same slice. So it's not possible to go deeper into the element
slices. Here is a proof with a simple array:
int[] a;
static assert(is(typeof(a[]) == typeof(a[][][][])));
Ali
More information about the Digitalmars-d-learn
mailing list