Le 2012-04-10 à 0:06, Jonathan M Davis a écrit :

> Having to duplicate pretty much every single function which takes a const ref 
> - opEquals and opCmp being very prominent among them - is a definite problem. 
> That's the problem that auto ref was intended to solve, and as long as it 
> only 
> works with templated functions, it really doesn't solve the problem.

I think the implementation of auto-ref you want is one where the argument is 
always passed by ref but it the function would also accept lvalues. I think 
"auto ref" is a misnomer for that.

Actually, I think the true problem you are trying to solve using auto-ref is 
one of efficiency: you don't want all structs to be passed by copy because 
often that'd be inefficient. Disregarding efficiency, all cases where you want 
to use auto-ref you could pass the struct by copy instead. Am I right?

-- 
Michel Fortin
[email protected]
http://michelf.com/



_______________________________________________
dmd-beta mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-beta

Reply via email to