summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qvarlengtharray.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qvarlengtharray.h')
-rw-r--r--src/corelib/tools/qvarlengtharray.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h
index 2a86a1dd7f..c412f96110 100644
--- a/src/corelib/tools/qvarlengtharray.h
+++ b/src/corelib/tools/qvarlengtharray.h
@@ -228,20 +228,19 @@ public:
if (size() == capacity()) { // i.e. size() != 0
T copy(t);
reallocate(size(), size() << 1);
- const qsizetype idx = s++;
- new (data() + idx) T(std::move(copy));
+ new (end()) T(std::move(copy));
} else {
- const qsizetype idx = s++;
- new (data() + idx) T(t);
+ new (end()) T(t);
}
+ ++s;
}
void append(T &&t)
{
if (size() == capacity())
reallocate(size(), size() << 1);
- const qsizetype idx = s++;
- new (data() + idx) T(std::move(t));
+ new (end()) T(std::move(t));
+ ++s;
}
void append(const T *buf, qsizetype size);