Simplest way to create an array from an associative array which its contains keys and values?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Sun Jan 5 07:25:18 PST 2014
On 1/5/14, bearophile <bearophileHUGS at lycos.com> wrote:
> Perhaps the "s" suffix (to define fixed-sized arrays) could avoid
> that problem:
>
> string[] r = aa.byKey.map!(k => [k, aa[k]]s).join;
I would prefer a prefix though, to make it immediately obvious you're
creating a static array.
string[] r = aa.byKey.map!(k => s[k, aa[k]]).join;
It's not too bad..
But then again maybe tuples (and some syntax support) is the right
solution for this.
More information about the Digitalmars-d-learn
mailing list