On 02/16/2012 11:07 AM, Don Clugston wrote:
On 16/02/12 06:38, Martin Nowak wrote:
On Thu, 16 Feb 2012 00:46:35 +0100, Trass3r <[email protected]> wrote:

I posted this question several times already and no answer yet,
why is allowing temporaries bind to ref const params bad again?

You'd want to pass temporaries by value, because then they can be
constructed saving you a copy.
If you want a function that avoids copies for lvalues and rvalues then
you need auto ref :(.

Yes but that doesn't work for const.


I think it does. What would be the problem?

C++'s 'const &' is very easy to get wrong.

Yes, but D still hasn't got it right.
As far as I can tell, "const ref" in a parameter list is ALWAYS a bug.

Why? It is perfectly reasonable to pass a large struct by const ref.

Reply via email to