几个比较容易忘记的东西.......
移动构造函数:
Vector(Vector &©) //移动构造函数 { if(copy.A!=NULL) { A=copy.A; copy.A=NULL; n=copy.n; } }
重载等于号.完成深复制、
Vector& operator = (Vector& copy) //重载等于号 完成深复制. { if(A!=NULL) delete []A; n=copy.n; A=new int[n+5]; for(int i=0;i<n;i++) { A[i]=copy.A[i]; } return *this; }
移动复制构造运算
Vector& operator = (Vector&& copy) //移动复制构造运算 { if(A!=NULL) delete []A; n=copy.n; A=copy.A; copy.A=NULL; return *this }