dmd 1.066 and 2.051 release

Ali Çehreli acehreli at yahoo.com
Fri Dec 24 22:10:54 PST 2010


Caligo wrote:
> So what does one use in D if something like std::unordered_set is needed?

Like std::unordered_sets, D's associative arrays are hash tables.

A table of doubles indexed with string keys:

     double[string] my_table;

Ali

> RedBlackTree is ordered as far as I can tell.
> 
> On Fri, Dec 24, 2010 at 6:08 PM, Jonathan M Davis <jmdavisProg at gmx.com>wrote:
> 
>> On Friday 24 December 2010 00:02:06 Caligo wrote:
>>> Why are they calling it RedBlackTree? why not Set?  C++ std::set is a
>>> red-black tree as far as I know, but they named it set.
>> Andrei decided that the containers in Phobos will named after what they
>> actually
>> are instead of what they're used for. A prime example of this is a
>> red-black
>> tree. It can be used as a set. Depending on the implementation (I haven't
>> look
>> at the Phobos one yet), it can also be used as a map (it's used for both
>> set and
>> map in C++'s STL). But a set could be implemented in many different ways. A
>> red-
>> black tree is only one of them. It could be implemented with a hash
>> instead. But
>> that would give it very different performance characteristics.
>>
>> Phobos is taking the approach that a container is labeled for the data
>> structure
>> that it is rather than what it's used for. That way it's very clear what
>> it's
>> performance characteristics are. If you want to use the term Set in your
>> code,
>> then simply alias RedBlackTree to Set.
>>
>> - Jonathan M Davis
>>
> 


More information about the Digitalmars-d-announce mailing list