From 8d1d12a32896cca3f9aaae31ae2a3ee28dc8f276 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 19 Jul 2015 10:25:30 +0200 Subject: [PATCH] QVector: in append(), if we take a copy, then move, not copy from the copy Replaces one copy ctor / assignment with a move ctor / assignment. Change-Id: I56768db9904283a9be7c87f624a557a64557bc8f Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qvector.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 624d828a3b..1a7692c0f4 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -625,14 +625,14 @@ void QVector::append(const T &t) { const bool isTooSmall = uint(d->size + 1) > d->alloc; if (!isDetached() || isTooSmall) { - const T copy(t); + T copy(t); QArrayData::AllocationOptions opt(isTooSmall ? QArrayData::Grow : QArrayData::Default); reallocData(d->size, isTooSmall ? d->size + 1 : d->alloc, opt); if (QTypeInfo::isComplex) - new (d->end()) T(copy); + new (d->end()) T(qMove(copy)); else - *d->end() = copy; + *d->end() = qMove(copy); } else { if (QTypeInfo::isComplex)