foreach ( i; 1 .. n ) and parallel()

Lee Braiden leebraid at gmail.com
Sat Feb 23 16:04:35 PST 2013


Just a quick conceptual question: why doesn't the following work?

foreach(i ; parallel(1 .. 11))
{
    ...
}

I would have expected 1 .. 10 to give me a range, and parallel to work 
with that.  Does 1 .. 11 ONLY work as part of the foreach() syntax?

If not, is there some sort of range generator helper, like python's range
() function, which I can use something like:

r = range(1,11);

foreach( i; parallel(r))
{
    ...
}



Thanks,

-- 
Lee


More information about the Digitalmars-d-learn mailing list