I have tried this both on the online tour of D and with ldc locally. This Error puzzles me. What is so special about char compared to int so that it cannot be made a ref from parallel?
import std.stdio : writeln;
import std.parallelism;
void main()
{
auto arr = [1,2,3,4,5,6,7,8];
foreach(ref i; parallel(arr)) {
//writeln(typeid(i));
i = i*i;
}
writeln(arr);
auto result = [ 'w','e','l','c','o','m','e','t','o','d'];
//foreach( ref c; parallel(result)) --> Error: foreach: cannot make c ref
foreach( ref c; result)
{
//writeln(typeid(c));
c = 'a';
}
writeln(result);
writeln(typeid(arr));
writeln(typeid(result));
}