Use std::destroy() instead if handwritten loop

Change-Id: Ia75296abf804332bb6f53dbb9a2eed8600b6e8b4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Lars Knoll 2020-11-10 11:00:26 +01:00
parent 0b1ca7c001
commit 590d4b3443

View File

@ -509,10 +509,8 @@ public:
Q_ASSERT(!this->isShared());
Q_ASSERT(newSize < size_t(this->size));
const T *const b = this->begin();
do {
(b + --this->size)->~T();
} while (size_t(this->size) != newSize);
std::destroy(this->begin() + newSize, this->end());
this->size = newSize;
}
void destroyAll() // Call from destructors, ONLY
@ -523,11 +521,7 @@ public:
Q_ASSERT(this->d->ref_.loadRelaxed() == 0);
const T *const b = this->begin();
const T *i = this->end();
while (i != b)
(--i)->~T();
std::destroy(this->begin(), this->end());
}
void insert(GrowsForwardTag, T *where, const T *b, const T *e)