Red black trees

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Thu Oct 26 15:54:34 PDT 2006


Walter Bright wrote:
> clayasaurus wrote:
>> I'd also like to add, that if you do give me the heads up that you 
>> would like to see this to phobos, give me time to...
> 
> I'd like to:
> 
> 1) change RedBlackTree to take two type arguments: Key and Value types. 
> The user needn't see the Node type at all.

I don't know, wouldn't adding an explicit value type waste space when 
it's not needed?
You can always easily fake Key/Value by specializing T for a 'struct 
Tuple(Key, Value)' with comparison operators forwarded to the key, can't 
you?
Though you could also allow Value to be void and specialize the node 
type for that so it doesn't contain a Value in that case. Maybe even 
make void the default type for Value?



More information about the Digitalmars-d mailing list