'What does it mean: "a move operation is never implicitly defined as a deleted function" in C++Primer 5th edition?
I am reading "C++ Primer", 5th edition. And I can not understand the following passage. It comes from page 538~539.
Unlike the copy operations, a move operation is never implicitly defined as a deleted function.
Never? But aren't all the definitions mentioned later implicit?
However, if we explicitly ask the compiler to generate a move operation by using
= default(§ 7.1.4, p. 264), and the compiler is unable to move all the members, then the move operation will be defined as deleted. With one important exception, the rules for when a synthesized move operation is defined as deleted are analogous to those for the copy operations (§ 13.1.6, p. 508):
Unlike the copy constructor, the move constructor is defined as deleted if the class has a member that defines its own copy constructor but does not also define a move constructor, or if the class has a member that doesn’t define its own copy operations and for which the compiler is unable to synthesize a move constructor. Similarly for move-assignment.
The move constructor or move-assignment operator is defined as deleted if the class has a member whose own move constructor or move-assignment operator is deleted or inaccessible.
Like the copy constructor, the move constructor is defined as deleted if the destructor is deleted or inaccessible.
Like the copy-assignment operator, the move-assignment operator is defined as deleted if the class has a const or reference member.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
