parallel foreach

Alex via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 1 15:23:49 PDT 2017


On Monday, 1 May 2017 at 13:24:55 UTC, Nicholas Wilson wrote:
> Because staticIota expands to 0,1,2,3,4
> so you are trying todo
> foreach(i; parallel(0,1,2,3,4){}
> which doesn't work.
> try
> foreach(i; parallel([staticIota!(0, 5)])){}
> or
> foreach(i; parallel(only(staticIota!(0, 5)))){}
> not sure of the second one will work.

Ah thanks. Both versions work.


More information about the Digitalmars-d-learn mailing list