<div class="gmail_quote">On Thu, Mar 29, 2012 at 2:42 PM, Sean Silva <span dir="ltr"><<a href="mailto:silvas@purdue.edu">silvas@purdue.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Could someone explain why the second one is move-constructible and move-assignable while the first one is not?<div><br></div><div>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?</div>
</blockquote><div><br></div><div>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 <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2904.pdf">http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2904.pdf</a> based on some notion of efficiency concerns.</div>
<div><br></div><div>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.</div>
</div>