joiner random access range?

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 8 16:06:10 PST 2014


Given a 2D array, I'd like to sort its items sequentially:


import std.stdio, std.algorithm, std.range;

void foo(int[][] m) {
     m.joiner.sort().writeln; // error
}
void main() {
     auto m = [[10, 2], [30, 4]];
     m.joiner.writeln;
     foo(m);
     m.joiner.writeln;
     // OK, but the matrix can have arbitrary many rows.
     chain(m[0], m[1]).sort();
     m.joiner.writeln;
}


Is it possible and reasonable for "joiner" to return a random 
access range in such cases (where the input is a random access 
range of random access ranges), so I can sort its items?

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list