Boost logo

Boost :

Subject: Re: [boost] [operators] What is the correct overload set for a binary operator?
From: Andrew Ho (helloworld922_at_[hidden])
Date: 2013-04-28 19:01:20


> Er, no, there are many unnecessary moves in this version that would go
> away if we returned a reference.

Did some testing, yeah, you're right, though the original test cases presented
by Daniel didn't cause them to show up in VS2012 or GCC 4.7.2.

Additional test cases:

T a, b, c, d;

T r4 = a + b + c + d; // extra temporary created for + d if no return rvalue
ref

r4 = a + b + c; // extra temporary created for assignment operator if no
return rvalue ref


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk