diff options
Diffstat (limited to 'tests/auto/corelib/tools/qarraydata')
-rw-r--r-- | tests/auto/corelib/tools/qarraydata/simplevector.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/auto/corelib/tools/qarraydata/simplevector.h b/tests/auto/corelib/tools/qarraydata/simplevector.h index e7032f0608..54c5fd2f61 100644 --- a/tests/auto/corelib/tools/qarraydata/simplevector.h +++ b/tests/auto/corelib/tools/qarraydata/simplevector.h @@ -237,11 +237,15 @@ public: return; } - // Temporarily copy overlapping data, if needed if ((first >= where && first < end) || (last > where && last <= end)) { - SimpleVector tmp(first, last); - d->insert(where, tmp.constBegin(), tmp.constEnd()); + // Copy overlapping data first and only then shuffle it into place + T *start = d->begin() + position; + T *middle = d->end(); + + d->copyAppend(first, last); + std::rotate(start, middle, d->end()); + return; } |