std.container.RedBlackTree versus C++ std::set

Rob T alanb at ucora.com
Thu Feb 14 10:45:30 PST 2013


When I look at the std.container source code, it seems that the 
payload element is passed by value multiple times unnecessarily, 
so to minimize copy construction you'll have to implement element 
as a class and implement a dup function for it.

I expect performance will increase substantially even with the 
extra heap allocations.

Alternatively, you can implement your own version of RedBlackTree 
with pass by ref optimizations for insertion of struct elements.

--rt


More information about the Digitalmars-d-learn mailing list