<br>So what does one use in D if something like std::unordered_set is needed?  RedBlackTree is ordered as far as I can tell.<br><br><div class="gmail_quote">On Fri, Dec 24, 2010 at 6:08 PM, Jonathan M Davis <span dir="ltr"><<a href="mailto:jmdavisProg@gmx.com">jmdavisProg@gmx.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">On Friday 24 December 2010 00:02:06 Caligo wrote:<br>
> Why are they calling it RedBlackTree? why not Set?  C++ std::set is a<br>
> red-black tree as far as I know, but they named it set.<br>
<br>
</div>Andrei decided that the containers in Phobos will named after what they actually<br>
are instead of what they're used for. A prime example of this is a red-black<br>
tree. It can be used as a set. Depending on the implementation (I haven't look<br>
at the Phobos one yet), it can also be used as a map (it's used for both set and<br>
map in C++'s STL). But a set could be implemented in many different ways. A red-<br>
black tree is only one of them. It could be implemented with a hash instead. But<br>
that would give it very different performance characteristics.<br>
<br>
Phobos is taking the approach that a container is labeled for the data structure<br>
that it is rather than what it's used for. That way it's very clear what it's<br>
performance characteristics are. If you want to use the term Set in your code,<br>
then simply alias RedBlackTree to Set.<br>
<font color="#888888"><br>
- Jonathan M Davis<br>
</font></blockquote></div><br>