DIP80: phobos additions

Ilya Yaroshenko via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 9 04:15:52 PDT 2015


> size_t anyNumber;
> auto ar = new int[3 * 8 * 9 + anyNumber];
> auto slice = Slice[0..3, 4..8, 1..9];
> assert(ar.canBeSlicedWith(slice)); //checks that ar.length <= 3 
> * 8 * 9
>
> auto tensor = ar.sliced(slice);
> tensor[0, 1, 2] = 4;
>
> auto matrix = tensor[0..$, 1, 0..$];
> assert(matrix[0, 2] == 4);

assert(&matrix[0, 2] is &tensor[0, 1, 2]);


More information about the Digitalmars-d mailing list