
28 Apr
2013
28 Apr
'13
11:01 p.m.
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