I am wondering why the committee has decided that a move constructor is implicitly deleted when a destructor is defined.
#include <iostream>
#include <vector>
#include <memory>
struct A {
~A(){};
std::unique_ptr<int> a;
};
int main()
{
A a;
A b = std::move(a);
}
http://coliru.stacked-crooked.com/a/c0c067fc51260794
Is there any utopic use-case for which this rule "of not default moving the members" makes sense?
The logic is: if you define a destructor that implies it releases resources there, so that compiler-generated constructors and assignments are probably not adequate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With