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

Ivan Kazmenko gassa at mail.ru
Thu Feb 14 16:33:55 PST 2013


Steven Schveighoffer wrote:

> Again, the issue here is D has restrictions on ref parameters.  
> There are no such restrictions on pass-by-value parameters.  So 
> by default, the predicate tries by-value.

I am starting to understand the difficulty with ref being too 
restrictive.  Some kind of "const ref" in the language would have 
helped indeed.  But it would probably cause some allocation 
difficulties for actual constants... or worse?

> In this case, RedBlackTree is always assured of having lvalues 
> for the predicate, so I can probably make the default use 
> pass-by-ref.  If you could file a bug, that would be most 
> helpful.

Done! http://d.puremagic.com/issues/show_bug.cgi?id=9513


More information about the Digitalmars-d-learn mailing list