[Issue 9513] RedBlackTree excessively copies structs by value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 15 06:58:51 PST 2013


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


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com


--- Comment #7 from Steven Schveighoffer <schveiguy at yahoo.com> 2013-02-15 06:58:45 PST ---
(In reply to comment #3)
> (In reply to comment #1)
> > The second program gives me:
> > 
> > temp.d(28): Error: template instance RedBlackTree!(element, lessfun)
> > RedBlackTree!(element, lessfun) does not match template declaration
> > RedBlackTree(T, alias less = "a < b", bool allowDuplicates = false) if
> > (is(typeof(binaryFun!(less)(T.init, T.init))))
> 
> The function taking ref arguments can not work for T.init and T.init since ref
> implies lvalue.

Yes, this was recently more strictly enforced.  However, the function will only
ever be called on lvalues inside the class

We should change the if statement to something like this:

if(is(typeof({T t; bool x = binaryFun!less(t, t);})))

That should fix the issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list