Andrei Alexandrescu wrote: > 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
I was looking for remove(ElementType value) but this function is not listed anywhere in std.container. The entry for stableRemoveAny(v) references removeAny(v) - note the parameter - so I thought that indicated the intent of a function removeAny(ElementType) but it doesn't exist in the table either. I assumed (mistakenly) that removeAny(v) would remove any value x where x == v from the container, where the choice of which would be left up to the container.