
12 Jun
2012
12 Jun
'12
5:17 p.m.
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?
<http://cpp-next.com/archive/2009/08/want-speed-pass-by-value/comment-page-1/#comment-82>