Right after allocators: containers or database connectivity?

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 11 13:23:29 PDT 2015


On Thursday, 11 June 2015 at 12:47:46 UTC, Steven Schveighoffer 
wrote:
> On 6/9/15 6:05 PM, Jonathan M Davis wrote:
>> On Tuesday, 9 June 2015 at 18:49:04 UTC, Brad Anderson wrote:
>>> We also have map in the form of RedBlackTree. I think you 
>>> might be
>>> able to use RedBlackTree for a set too but I haven't tried it.
>>
>> You can, but it's a bit of a pain, because you have to keep 
>> passing it a
>> tuple where the value gets ignored. We really need a wrapper 
>> around it
>> to make it cleaner.
>
> Map is a pain. Set is not. The apparatus around RedBlackTree in 
> dcollections to turn it into a map is non-trivial, and is 
> worthy of having in std.container. TreeSet, however, was pretty 
> much straight mapping to implementation calls.

You're right. It's been too long since I used it, and I didn't 
think it through enough. As I recall, the main problem has to do 
with all of the cases that you have to pass in a tuple where only 
the key matters, and for some reason, I was thinking that that 
was the set case, when it's obviously the map case. The set case 
could pretty much be an alias if we wanted TreeSet or SortedSet 
in the library, whereas TreeMap/SortedMap would need to be a 
wrapper around RedBlackTree.

- Jonathan M Davis


More information about the Digitalmars-d mailing list