Boost logo

Boost :

Subject: Re: [boost] [move][container] Fast-track reviews for Move and Container?
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2009-08-17 16:16:56


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 17 August 2009, Thomas Klimpel wrote:
> > Type & operator=(BOOST_RV_REV(Type) t)
> > {
> > Type tmp(boost::move(t));
> > this->swap(tmp);
> > }
>
> I hope I can omit the temporary, because two calls to swap are less
> efficient than a single call to swap. I can't find any second thought that
> forces me to create a temporary. Do I miss something?

I don't think you need to. The temporary is useful if you want to always give
moved-from objects a specific state (presumably the move constructor does
this). But the standard is looser, it only requires the moved-from object
doesn't violate any of the class invariants.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkqJurkACgkQ5vihyNWuA4UPdwCcDx1z5q4kVkqgF6wcUNMQItqa
N+AAn28ftrbGEi8hohQRJGSl+WdIYx7M
=swov
-----END PGP SIGNATURE-----


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