container stuff

bearophile bearophileHUGS at lycos.com
Thu May 27 02:59:43 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.

Bye,
bearophile


More information about the Digitalmars-d mailing list