associative arrays: iteration is finally here

Leandro Lucarella llucax at gmail.com
Thu Oct 29 07:53:44 PDT 2009


Andrei Alexandrescu, el 28 de octubre a las 20:29 me escribiste:
> >>Your test looks something up and then removes it.
> >>
> >>
> >>Andrei
> >
> >Well, my extended test case looks something up, manipulates the
> >found value, and then possibly removes it.
> 
> Ok, I understand your points, thanks for explaining.

What about and overload of remove() like this:
bool remove(in T key, out U value);

If the element was present, it's returned in "value", so you can
manipulate it. I thought about just returning a pointer:
U* remove(in T key);

But I guess that pointer would point to the element stored in the the AA
private data, but that element was just removed, so bad things would
happen, that's why the only option is to copy the data, right?

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Y no es el centro del Universo! El sol gira alrededor de la tierra!
Miles de girasoles no pueden estar equivocados!
	-- Inodoro Pereyra



More information about the Digitalmars-d mailing list