Linear array to matrix

MoonlightSentinel moonlightsentinel at
Sat Apr 4 10:52:30 UTC 2020

On Saturday, 4 April 2020 at 09:25:14 UTC, Giovanni Di Maria 
> Is there a Built-in function (no code, only a built-in function)
> that transform a linear array to a Matrix?

You can combine slide [1] and array [2]:

import std;

void main()
     auto input = [10,20,30,40,50,60,70,80,90,100,110,120];
     auto output = input.slide(3, 3).array;


Note that output is a view of input and not a copy.


More information about the Digitalmars-d-learn mailing list