Re: C++11 features, move semantics?

On Wed, 21 Jan 2015 08:39:46 +0100
Murray Cumming <murrayc murrayc com> wrote:
On Sun, 2014-12-28 at 15:42 +0100, Christof Meerwald wrote:

just wondering if anyone has given any thought on C++11 features for

One thing that seems very unfortunate is that all objects are
non-movable (due to them being explicitly made non-copyable which
then also deletes the move constructor).

I believe it's possible to make classes movable but not copyable. That
feels strange to me, but maybe that's just because I'm not using C++11
day to day. I hope that this wouldn't lead to code that looked too
much like the widgets were being copied. I can imagine a lot of
confusion from less experienced coders.

It is possible (the canonical example is of course std::unique_ptr) and
it does not confuse, because lvalues can only be moved by converting
them to rvalues, in other words by calling std::move on them.  Calling
std::move makes it clear, I think, that no copying is involved.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]