On 03/08/2012 12:09 PM, ixid wrote: > Changing a[][2] to a[][] as suggested made it work. It's not clear to me > why it should matter that it's not dynamic in that axis or are arrays > simply static or dynamic globally?
The reason is that fixed-length arrays cannot be ranges themselves because popFront() cannot be implemented on them. Luckily though, we can very easily take a whole slice of a fixed-length array and that would be a range.
The following code has the same problem as yours: // WARNING: Cannot be compiled import std.stdio; import std.parallelism; void main() { int[2] array = [ 1, 2 ]; foreach (element; parallel(array)) { writeln(element); } } The fix is to pass a slice of array to parallel(). Now it works: foreach (element; parallel(array[])) { // <-- note [] } Now parallel() will consume the temporary slice that is passed to it. Ali