www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - chunks result to array

reply forkit <forkit gmail.com> writes:
I want to do the equivalent of this:

int[][] arrayOfarrays =  [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 
12, 13, 14, 15]];

But getting the initialiser values using iota and chunks instead.

Any help will be appreciated.

note: to2Darray is not a valid statement ;-)


// ---
module test;

import std;

void main()
{
     int[][] arrayOfarrays = iota(1, 16).chunks(5).to2Darray; // 
how to convert this into [][]
}
// ----
Jan 14 2022
parent forkit <forkit gmail.com> writes:
On Saturday, 15 January 2022 at 03:18:21 UTC, forkit wrote:

oops. ignore this - was a repost of another post that I thought 
never got posted ;-)
Jan 14 2022