Boost logo

Boost :

Subject: Re: [boost] rvalue ref best practices?
From: Peter Dimov (pdimov_at_[hidden])
Date: 2012-06-12 16:54:22


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.


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