Boost logo

Boost :

Subject: Re: [boost] [variant] Basic rvalue and C++11 features support
From: Peter Dimov (lists_at_[hidden])
Date: 2013-01-08 12:53:16


Philipp Moeller wrote:
> The only situation, I am aware of, where a value is still accessible
> after being moved is when it is forcibly converted to an T&& through
> std::move or a cast ("explictliy specified" in 12.8), so this shouldn't
> be permissible for some types.
...
> I think this is a defect of the standard library definition because you
> really want to implement some types that way and it should be possible
> to do it.

No, you really don't want to implement a type this way. It would break* the
default implementation of std::swap and most of the rest of the standard
library. Moving from lvalues is an important use case.

* Where "break" is a shorthand for "reduce performance significantly".


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