Assosiative array pop

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 25 02:56:24 PDT 2014


seany:

> int[string] k;
> // populate k here
>
> int[string] j;
>
>
> foreach(sttring key, int val; k)
> {
>
> j[key] = val;
> break;
> }

This is OK, and you can encapsulate this into a little function. 
But you are not removing the pair from the first associative 
array. So you have to remove the item before the break.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list