Hello

I'm playing around with my first D program and can't figure out a way to chain a dynamic number of ranges. In this example I'm trying to chain a two dimensional array into effectively a one dimensional array, so I can later sort it as one sequence.


--------
import std.algorithm;
import std.range;

// n is determined at runtime
uint[][] arrays = new uint[][n];
foreach(ref a; arrays)
{
    a = new uint[10];
    copy(iota(10), a);
}

auto c = chain(arrays[0], arrays[1]);
foreach(a; arr[2..$])
{
    c = chain(c, a);
}
--------

Gives a compile error:
Error: cannot implicitly convert expression (chain(c,a)) of type Result to Result

any ideas?

Thanks.


Reply via email to