automate tuple creation
    forkit 
    forkit at gmail.com
       
    Fri Jan 21 21:01:11 UTC 2022
    
    
  
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] ];
}
    
    
More information about the Digitalmars-d-learn
mailing list