Boost logo

Boost :

Subject: Re: [boost] rvalue ref best practices?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-06-12 13:17:31

On 06/12/2012 06:05 PM, Dave Abrahams wrote:

> That's because you wrote it wrong. It should be
> foo(T t_) : t(std::move(t_)) {}

That does one copy plus one move for lvalues, while a single copy would
have been enough with

foo(T const& t_) : t(t_) {}

There is no point in the pass-by-value to elide copies with rvalues
technique at all in C++11 anyway. The only uses it could have were
limited to C++03.

>> I had already pointed out to Dave that the way the rule as worded was
>> incorrect.
> ? you did?


Boost list run by bdawes at, gregod at, cpdaniel at, john at