You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would agree, especially since we have move semantics now. That function could just be refactored into array& operator=(array&& b). Not sure how this works in the context of the book though; it might be worth staying consistent with what Java is doing, since that's the original language used in the book.
// https://github.com/patmorin/ods/blob/master/cpp/array.h
array& operator=(array &b) {
if (a != NULL) delete[] a;
a = b.a;
b.a = NULL;
length = b.length;
return *this;
}
a = b.a; // This is not deep copy.
The text was updated successfully, but these errors were encountered: