On 2014-01-01 22:54, Cooler wrote:
Example in C++:
   set<int> uniqueInts;
   assert(uniqueInts.count(99) == 0);
   uniqueInts.insert(99);
   assert(uniqueInts.count(99) == 1);
   uniqueInts.erase(99);
   assert(uniqueInts.count(99) == 0);

Which it will be analogue solution in D?

I need a collection that can hold number of items, and can tell me
weather is an item in the collection or not. I found that RedBlackTree
can help me. But RedBlackTree uses O(log(n)) time for insert/remove
operations. On the other hand we have built-in associative arrays with
hashed keys. But associative arrays requires pairs of (key, value),
which is quite wasting in my case.
May be it will be convenient to allow void[key] built-in collections?
Any suggestion?

Tango contains collection, among the a hash set:

http://siegelord.github.io/Tango-D2/tango.util.container.HashSet.html
https://github.com/SiegeLord/Tango-D2

--
/Jacob Carlborg

Reply via email to