On Friday, 21 January 2022 at 18:50:46 UTC, Steven Schveighoffer wrote:

Yeah, iota is a random-access range, so you can just pass it directly, and not allocate anything.

Looking at the usage, it doesn't need to be an array at all. But modifying the code to properly accept the range might prove difficult for someone not used to it.

-Steve

thanks. that makes more sense actually ;-)

now i can get rid of the idArray completely, and just do:

foreach(i, id; enumerate(iota(iotaStartNum, iotaStartNum + recordsNeeded)))
{
    records ~= [ id: valuesArray[i] ];
}

Reply via email to