diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-11-12 16:41:58 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-11-17 11:47:36 +0100 |
commit | 996255baae06310b09892f4376fb8b3227ecbb70 (patch) | |
tree | 4f9bc12f20763c9e12865d533853d0a1cdd5bbe4 /src/corelib/tools/qlist.h | |
parent | c0e1a38f69cb3bc43649c7a45896b1fcf807279a (diff) |
Fix signature of QArrayDataOps::erase()
Bring it in line with the other methods that also take a
pointer and a size.
Also use truncate() in removeAll() as that's more efficient
for the use case.
Change-Id: Ib1073b7c048ceb96fb6391b308ef8feb77896866
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r-- | src/corelib/tools/qlist.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index daf9d43fd9..4511e1282a 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -341,7 +341,7 @@ public: inline reference emplaceFront(Args&&... args); iterator insert(qsizetype i, parameter_type t) - { return insert(i, 1, t); } + { return emplace(i, t); } iterator insert(qsizetype i, qsizetype n, parameter_type t); iterator insert(const_iterator before, parameter_type t) { @@ -448,7 +448,7 @@ public: const AT &tCopy = CopyProxy(t); const iterator e = end(), it = std::remove(begin() + index, e, tCopy); const qsizetype result = std::distance(it, e); - d->erase(it, e); + d->truncate(d->size - result); return result; } template <typename AT = T> @@ -661,7 +661,7 @@ inline void QList<T>::remove(qsizetype i, qsizetype n) return; d.detach(); - d->erase(d->begin() + i, d->begin() + i + n); + d->erase(d->begin() + i, n); } template <typename T> |