A case for valueless AA's?

dsimcha dsimcha at yahoo.com
Tue Mar 29 20:02:35 PDT 2011


On 3/29/2011 8:37 PM, Jonathan M Davis wrote:
> We now have std.container.RedBlackTree, which can be used as a set, but it is
> a tree rather than a hash table.
>
> - Jonathan M Davis

This isn't a very good set.  It doesn't even support basic set 
primitives like intersection, difference, union, etc.  Furthermore, most 
programs will probably want a hash set.  A tree set is only better when 
you don't have a good hash function or worst case performance is more 
important than average case.

I'm not saying there's anything wrong with RedBlackTree.  It's a 
perfectly good data structure to implement a set on top of.  It's just 
that it's not a "real" set type because it's not meant to be.


More information about the Digitalmars-d mailing list