
12 Jun
2012
12 Jun
'12
8:54 p.m.
Mathias Gaunard wrote:
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_) {}
That, however, does a copy for rvalues, too.