iota to array

psychoticRabbit meagain at meagain.com
Sun Feb 25 05:24:54 UTC 2018


Hi. Anyone know whether something like this is possible?

I've tried various conversions/casts, but no luck yet.

Essentially, I want to cast the result set of the iota to an 
array, during initialisation of the variable.

no, I don't want to use 'auto'. I want an array object ;-)

--------------
module test;

import std.stdio;
import std.range : iota;

void main()
{
     int[] intArr = iota(1, 11); // 1..10
     double[] doubleArr = iota(1.0, 11.0); // 1.0..10.0
     char[] charArr = iota('a', '{');  // a..z
}
-------------



More information about the Digitalmars-d-learn mailing list