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

Reply via email to