nospam at nospam.com
Thu May 27 04:49:17 PDT 2010
> Jonathan M Davis:
>> Well, I've never needed to do that particular operation on _any_ container,
>> so it does strike me as weird regardless. I've basically always been looking
>> to remove a specific element or elements or to remove the element at a
>> specific location.
> You have probably missed my other answer. But I can add some more. That operation is common.
> You use it every time you have a container that doesn't define a deterministic order (like hash sets, hash associative arrays, and so on) and you want to process and consume its items. In such collection you can't ask to pop the last or first item because they are not defined. So you pop out one randomly. I have used it many times in my programs.
When is it better to do it that way, rather than just iterating over all
elements, and then completely empty the container?
(Just curious -- I'm having trouble thinking of a use case for this
More information about the Digitalmars-d