www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - is there a set container?

reply Namal <sotis22 mail.ru> writes:
Hello,

I am looking for data structure equivalent to std::set from C++. 
Couldn't find it in the documentation.
Jan 25 2016
parent Adam D. Ruppe <destructionator gmail.com> writes:
The std.container.RedBlackTree is close:

http://dlang.org/phobos/std_container_rbtree.html


Or you may prefer my work-in-progress unofficial docs:

http://dpldocs.info/experimental-docs/std.container.rbtree.RedBlackTree.html

You can see methods there like insert, removeKey, and 
opBinaryRight, which is actually the in operator:

http://dpldocs.info/experimental-docs/std.container.rbtree.RedBlackTree.opBinaryRight.html

to see if an element exists in the set.


Create a red black tree with this convenience function:

http://dpldocs.info/experimental-docs/std.container.rbtree.redBlackTree.1.html
Jan 25 2016