[cfe-dev] deprecating copy construction and assignment

Richard Smith richard at metafoo.co.uk
Thu Mar 29 15:59:16 PDT 2012


On Thu, Mar 29, 2012 at 2:42 PM, Sean Silva <silvas at purdue.edu> wrote:

> Could someone explain why the second one is move-constructible and
> move-assignable while the first one is not?
>
> How does explicitly defaulting the move-constructor and move-assignment
> cause A to *not* be move-constructible nor move-assignable, while omitting
> them makes A be move-constructible and move-assignable?
>

The standard says that a defaulted move-constructor or move-assignment is
deleted if a base class or non-static data member has no corresponding move
operation, and the corresponding copy operation is non-trivial. This rule
was introduced in
http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2904.pdf based on
some notion of efficiency concerns.

The result is that explicitly defaulting the move operations gives you
defaulted move operations, and not declaring them gives you no move
operations. In the latter case, an attempt to move will successfully use
the copy operations instead.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120329/43e4e2bd/attachment.html>


More information about the cfe-dev mailing list