I ran into this issue the other day when writing a large class that needs additional book-keeping logic when being moved or copied. All fields could be copied/moved normally (just as the default versions would do), there was just a few extra function calls that needed to be made to sort things out. Whenever I added/removed fields in the class, I would have to reflect those changes in all my constructors, which became both bug-prone and a hassle. If there was a simple way to create a default move/copy constructor with some additional behavior in the body, that would be wonderful. Something along the lines of this:
MyType::MyType(const MyType& copy)
: default(copy)
{
// Additional logic
}
The constructor would then copy-construct all fields automatically, as well as running the additional code in the body. A copy-assignment operator could be implemented as such:
MyType& operator=(const MyType& copy)
{
if (this != ©)
{
default(copy);
// Addition logic
}
return *this;
}
Both examples could be easily extended to move construction/assignment as well.