Simplest way to create an array from an associative array which its contains keys and values?

bearophile bearophileHUGS at lycos.com
Sun Jan 5 05:37:24 PST 2014


Andrej Mitrovic:

> However the [k, aa[k]] expression will allocate an array for 
> each key you iterate over regardless if you use join or joiner. 
> I posted a solution with "only", hope that works. :)

Perhaps the "s" suffix (to define fixed-sized arrays) could avoid 
that problem:

string[] r = aa.byKey.map!(k => [k, aa[k]]s).join;

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list