Accessing a Hash table as a Value-Sorted Range

"Nordlöw" per.nordlow at gmail.com
Tue Nov 19 13:11:41 PST 2013


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;


More information about the Digitalmars-d-learn mailing list