We need to rethink remove in std.container

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Feb 22 05:21:08 PST 2011


On 2/22/11 3:04 AM, Lutger Blijdestijn wrote:
> The table in the docs mention stableRemoveAny(v) which says "Same as
> c.removeAny(v), but is guaranteed to not invalidate any iterators."
>
> Though c.removeAny(v) itself is not listed in the table nor implemented in
> RedBlackTree, isn't this the right function for the job? (I take it v stands
> for a value of the container, rather than a range). builtin aa's also
> implement this function.

I don't think removeAny() works for his case because he wants to remove 
a specific element from a container. removeAny() is useful when you want 
to express "pick one element from that container in the easiest way 
possible".

Andrei


More information about the Digitalmars-d mailing list