I have a struct that i want to be non copyable, only movable, but as it contains a lot of POD, writing move constructor would be long and forgetting a variable would be hard to debug. Example:
struct myStruct{
int a,b,c,d;
double e,f,g,h;
std::complex<double> value1,value2;
std::unique_ptr<Calculator> calc;
myStruct(){}
myStruct(const myStruct &)=delete;
myStruct(myStruct && other);
};
What would be the problems with this kind of move constructor:
myStruct::myStruct(myStruct && other){
std::memcpy(this,&other,sizeof(myStruct));
other.calc.release();
calc->rebind(this);
}
What problems could I face and is this well defined?