On 12/02/16 6:51 PM, Meta wrote:
If you try to compile this code, it will currently not work:
foreach (n; iota(1UL, 1000).parallel)
{
//...
}
This is because of how the length is calculated by iota:
auto iota(B, E)(B begin, E end)
if (isIntegral!(CommonType!(B, E)) || isPointer!(CommonType!(B, E)))
{
import std.conv : unsigned;
//...
//The return type of length. When either begin or end
//is ulong, then IndexType == ulong
alias IndexType = typeof(unsigned(end - begin));
static struct Result
{
private Value current, pastLast;
//...
@property IndexType length() const
{
return unsigned(pastLast - current);
}
}
return Result(begin, end);
}
And because std.parallelism.TaskPool.defaultWorkUnitSize takes a size_t,
which with a 32-bit DMD is uint.
What I want to know is, is this considered a bug? If so I will submit a
pull request to fix it.
So I assume if you compiled as 64bit this will work then?