[Feature Request] Adding to D lang "set" built-in

Chris Cain clcain at uncg.edu
Sat May 5 10:52:41 PDT 2012


There's a few ways to implement your own Sets right now, if 
needed. You found one way (using the built in AAs), but that's 
not all.

* You could use Array!bool (which efficiently stores bools) to 
store whether integers are in or out of your set.
* You can use std.container's redBlackTree to make a set which 
would work better if your items are objects or you're dealing 
with a sparse array.

There's probably a few other extremely simple methods, but those 
are the two I had on the top of my head. I'm not really sure 
having a particular "Set" in the library would be all that 
useful. Generally, if I want a set, I have a particular idea of 
how one should be implemented for my particular data.


More information about the Digitalmars-d mailing list