Assosiative array pop
seany via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jun 25 02:30:48 PDT 2014
Given an assosiative array : int[string] k, is there a way
(either phobos or tango) to pop the first element of this array
and append it to another array?
I can come up with a primitive soluiton:
int[string] k;
// populate k here
int[string] j;
foreach(sttring key, int val; k)
{
j[key] = val;
break;
}
but could it be better? it is wroth noting that the keys are not
known beforehand.
More information about the Digitalmars-d-learn
mailing list