www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - What about sets?

reply Andrea Fontana <advmail katamail.com> writes:
In c++ there are a lot of data structs (vector, hashmap, ...) defined by
stl. I need something similar to c++ "set" in D. Does it exists?
I don't care about order of items, but I need a fast search and a easy
way to iterate. A tree-like struct...
Nov 28 2011
parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Monday, November 28, 2011 11:48:28 Andrea Fontana wrote:
 In c++ there are a lot of data structs (vector, hashmap, ...) defined by
 stl. I need something similar to c++ "set" in D. Does it exists?
 I don't care about order of items, but I need a fast search and a easy
 way to iterate. A tree-like struct...
http://d-programming-language.org/phobos/std_container.html#RedBlackTree - Jonathan M Davis
Nov 28 2011
parent reply Andrea Fontana <advmail katamail.com> writes:
Thank you! I didn't check for "std.container" module :)

Il giorno lun, 28/11/2011 alle 02.55 -0800, Jonathan M Davis ha scritto:

 On Monday, November 28, 2011 11:48:28 Andrea Fontana wrote:
 In c++ there are a lot of data structs (vector, hashmap, ...) defined b=
y
 stl. I need something similar to c++ "set" in D. Does it exists?
 I don't care about order of items, but I need a fast search and a easy
 way to iterate. A tree-like struct...
=20 http://d-programming-language.org/phobos/std_container.html#RedBlackTree =20 - Jonathan M Davis
Nov 28 2011
parent reply Jonathan M Davis <jmdavisProg gmx.com> writes:
On Monday, November 28, 2011 12:09:45 Andrea Fontana wrote:
 Thank you! I didn't check for "std.container" module :)
I should warn you that std.container a bit sparse at the moment, but RedBlackTree does give you a set (or a sorted map with the appropriate comparator function). - Jonathan M Davis
Nov 28 2011
parent reply Andrea Fontana <advmail katamail.com> writes:
I was thinking to implement a redblack tree by myself so it's perfect!

Il giorno lun, 28/11/2011 alle 08.44 -0800, Jonathan M Davis ha scritto:

 On Monday, November 28, 2011 12:09:45 Andrea Fontana wrote:
 Thank you! I didn't check for "std.container" module :)
=20 I should warn you that std.container a bit sparse at the moment, but=20 RedBlackTree does give you a set (or a sorted map with the appropriate=
=20
 comparator function).
=20
 - Jonathan M Davis
Nov 29 2011
parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Also take a look at dcollections 2.0:
http://www.dsource.org/projects/dcollections (the d2 branch). I think
RBT was derived from there by Steven himself. Or maybe I'm thinking of
another structure.
Nov 29 2011