Improve MoveSelfInto. NFC.

std::swap is an idiomatic way to do a move.
This commit is contained in:
Ryan Pavlik 2019-05-23 12:27:48 -05:00 committed by whitequark
parent 9fd09ddd8a
commit b9d035c805

View File

@ -514,9 +514,9 @@ public:
void MoveSelfInto(IdList<T,H> *l) { void MoveSelfInto(IdList<T,H> *l) {
l->Clear(); l->Clear();
*l = *this; std::swap(l->elem, elem);
elemsAllocated = n = 0; std::swap(l->elemsAllocated, elemsAllocated);
elem = NULL; std::swap(l->n, n);
} }
void DeepCopyInto(IdList<T,H> *l) { void DeepCopyInto(IdList<T,H> *l) {