32 ms·
The implicitly-declared copy constructor is deleted if there is a user-defined move constructor. See: https://en.cppreference.com/w/cpp/language/copy_constructo
by datamart 8y ago
The implicitly-declared copy constructor is deleted if there is a user-defined move constructor. See: https://en.cppreference.com/w/cpp/language/copy_constructor#Deleted_implicitly-declared_copy_constructor https://en.cppreference.com/w/cpp/language/copy_constructor#...
So if you define a move constructor and still want your class to have a copy constructor, you'll have to explicitly define the copy constructor, too.
- mikec3010 8y agoThat makes sense, and hence the "rule of 5" (if you don't want it implicitly deleted). Thanks.
- microtherion 8y agoLuckily, in modern C++, defining the copy constructor in this case (where you just want to make the default available) is as simple as: A::A(const A &other) = default;