Edit: In C ++ 11, it is more complex than implicitly declared or not. They can be either implicitly declared, or defaulted, implicitly declared and deleted, or undeclared. Read this to distinguish the latter 2. The following information is not entirely correct, since it does not distinguish between declared and deleted vs undeclared.
Next is the work. (?) indicates that I would like to clarify or quantify the expression.
Special member functions §12 / 1
The implementation will implicitly declare these member functions for some class types when the user does not explicitly declare them:
- default constructor
- copy constructor Assignment operator
- move constructor Assignment operator
- destructor
A special member function will NOT be declared implicitly if the type has ...
Default Constructor §12.1 / 5
Copy constructor §12.8 / 8, §12.8 / 12
- user-declared move constructor
- custom operator assignment operator
- non-static data member of rvalue reference type
- option with a nontrivial copy constructor and is a unified class (?)
- non-static data member of type (or its array) that cannot be copied
- direct or virtual base class without copy constructor available
* Such an implicit declaration is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor (?)
Copy Assignment Operator §12.8 / 19, §12.8 / 24
- user-declared move constructor
- custom operator assignment operator
- a member of a variant with a nontrivial copy assignment operator and is a unified class (?)
- non-static data member of type const non-class (or its array)
- reference type non-static data element
- non-static data item with inaccessible copy assignment operator
- direct or virtual base class with inaccessible copy assignment operator
* Such an implicit declaration is deprecated if the class has a user-declared copy constructor or a user-declared destructor (?)
Move constructor §12.8 / 10, §12.8 / 12
- user-declared copy constructor
- custom copy assignment operator
- custom operator assignment operator
- user-declared destructor
- The move constructor will not be implicitly defined as remote (?)
- variant with a nontrivial constructor of displacement and is a unified class (?)
- non-static data member of the type (or its array) that cannot be moved
- a non-static data element or a direct or virtual base class with a type that does not have a move constructor and cannot be trivially copied
- direct or virtual base class with no move constructor available
Motion assignment operator §12.8 / 21, §12.8 / 24
- user-declared copy constructor
- user-declared move constructor
- custom copy assignment operator
- user-declared destructor Assignment Operator
- will not be implicitly defined as remote (?)
- a variant member with a nontrivial move assignment operator and is a joint class (?)
- non-static data member of type const non-class (or its array)
- reference type non-static data element
- a non-static data element with an unavailable move assignment operator and cannot be trivially copied
- direct or virtual base class with inaccessible assignment operator and cannot be trivially copied
Destructor §12.4 / 4
David source share