using a binary tree container

bearophile bearophileHUGS at lycos.com
Fri Feb 11 09:49:14 PST 2011


Dominic Jones:

> Would that not be constructing an associated array? Whilst an associated array
> would do the job, there is no value for the "key:value" pair, just a list of keys.
> In the C++ STL there are the "set" and "map" containers. I want something like "set".

Phobos2 is young, and it doesn't contain a HashSet yet. So you may use built-in associative arrays as a set, with a default value, or you may use the Ordered Tree Set that's in the collections module (look at the its unittests for some usage examples), or you may write a HashSet and then put it in Bugzilla so if it's good enough it will be added to Phobos. My suggestion is to use the built-in associative array.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list