Questions about the move assignment operator
Imagine the following class that manages a resource (my question is only about the move assignment operator): struct A { std::size_t s; int* p; A(std::size_t s) : s(s), p(new int[s]){} ~A(){delete [] p;} A(A const& other) : s(other.s), p(new int[other.s]) {std::copy(other.p, other.p + s, this->p);} A(A&& other) : s(other.s), p(other.p) {other.s = 0; other.p = nullptr;} A& operator=(A const& other) {A temp = other; std::swap(*this, temp); return *this;} // Move assignment operator #1 A& operator=(A&& other) { std::swap(this->s, other.s); std::swap(this->p, other.p); return *this; } // Move