Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Implicitly generated move constructors have been considered for the standard, but can be dangerous. See Dave Abrahams's <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3153.htm" rel="noreferrer">analysis</a>.</p> <p>In the end, however, the standard did include implicit generation of move constructors and move assignment operators, though with a fairly substantial list of limitations:</p> <blockquote> <p>If the definition of a class X does not explicitly declare a move constructor, one will be implicitly declared as defaulted if and only if<br> — X does not have a user-declared copy constructor,<br> — X does not have a user-declared copy assignment operator,<br> — X does not have a user-declared move assignment operator,<br> — X does not have a user-declared destructor, and<br> — the move constructor would not be implicitly defined as deleted.</p> </blockquote> <p>That's not quite all there is to the story though. A ctor can be declared, but still defined as deleted:</p> <blockquote> <p>An implicitly-declared copy/move constructor is an inline public member of its class. A defaulted copy/move constructor for a class X is defined as deleted (8.4.3) if X has:</p> <p>— a variant member with a non-trivial corresponding constructor and X is a union-like class,<br> — a non-static data member of class type M (or array thereof) that cannot be copied/moved because overload resolution (13.3), as applied to M’s corresponding constructor, results in an ambiguity or a function that is deleted or inaccessible from the defaulted constructor,<br> — a direct or virtual base class B that cannot be copied/moved because overload resolution (13.3), as applied to B’s corresponding constructor, results in an ambiguity or a function that is deleted or inaccessible from the defaulted constructor,<br> — any direct or virtual base class or non-static data member of a type with a destructor that is deleted or inaccessible from the defaulted constructor,<br> — for the copy constructor, a non-static data member of rvalue reference type, or<br> — for the move constructor, a non-static data member or direct or virtual base class with a type that does not have a move constructor and is not trivially copyable.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload