container stuff

Steven Schveighoffer schveiguy at yahoo.com
Wed May 26 18:18:09 PDT 2010


Jonathan M Davis Wrote:

> Looks interesting overall. There is one function, however, which makes no 
> sense to me: removeElement()/stableRemoveElement().
> 
> So, it basically removes a random element from the container? It could be 
> quite consistent as to which element it removes from the container (it being 
> implementation-dependent), but effectively, it removes a random element? 
> What's the point of that? I can't remember the last time - if ever - that I 
> wanted to remove an element from a container and I didn't care which. Or am 
> I misunderstanding what it does?

I think you are misunderstanding.  Random element means you can't tell which one is removed, but it doesn't *have* to be truly random :)  It most likely will be the most convenient element to remove (maybe that would be a better description).  In other words, you can't expect it to always be the last element, or the first element, or the lowest element, or whatever.

So essentially, I think that's what you were asking for, and I think that's what Andrei meant.

-Steve


More information about the Digitalmars-d mailing list