Content deleted Content added
m Added some other conditions that are needed for the compiler to generate a move assignment operator implicitly |
m →Overloading move assignment operator: array delete operator is required to free the storage of a char array that has bee allocated with the array new operator |
||
Line 18:
// If we're not trying to move the object into itself...
if (this != &other) {
delete[] this->data_; // Delete the string's original data.
this->data_ = other.data_; // Copy the other string's data into this string.
other.data_ = nullptr; // Finally, reset the other string's data pointer.
|