On Tuesday, 19 November 2013 at 21:14:01 UTC, Brad Anderson wrote:
On Tuesday, 19 November 2013 at 21:11:42 UTC, Nordlöw wrote:
If I have a hash-table `File[string] _subs` and want to access
its values in a sorted way is there a better than simply
through
auto ssubs = new File[_subs.length]; // preallocate sorted
subs
size_t ix = 0;
foreach (sub; _subs) {
ssubs[ix++] = sub; // set new reference to sub
}
ssubs.sort!((a, b) => (a.timeLastModified >
b.timeLastModified));
return ssubs;
I just found that I can use the .values property member:
import std.stdio, std.algorithm;
string[int] x = [0:"b", 1:"a"];
auto y = x.values.map!("a~a");
writeln(y);