From ab1180a2b0dd3124079162566da586e36f438ba5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 6 Dec 2021 16:51:02 +0100 Subject: [PATCH] QVarLengthArray: merge remove(idx [,n]) into one function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit remove(i) is the same as remove(i, 1), and the extra 'n' argument is of trivial type, so it's ok to default it instead of overloading. Change-Id: Id926cd63fde518e002684a41e055edc1004247a4 Reviewed-by: MÃ¥rten Nordheim --- src/corelib/tools/qvarlengtharray.h | 7 +------ src/corelib/tools/qvarlengtharray.qdoc | 10 ---------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 123faba26d..5b8d77dab0 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -260,8 +260,7 @@ public: void insert(qsizetype i, const T &t); void insert(qsizetype i, qsizetype n, const T &t); void replace(qsizetype i, const T &t); - void remove(qsizetype i); - void remove(qsizetype i, qsizetype n); + void remove(qsizetype i, qsizetype n = 1); template qsizetype removeAll(const AT &t); template @@ -598,10 +597,6 @@ inline void QVarLengthArray::remove(qsizetype i, qsizetype n) { verify(i, n); erase(begin() + i, begin() + i + n); } template -inline void QVarLengthArray::remove(qsizetype i) -{ verify(i); - erase(begin() + i, begin() + i + 1); } -template template inline qsizetype QVarLengthArray::removeAll(const AT &t) { return QtPrivate::sequential_erase_with_copy(*this, t); } diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index 0ba939ab60..b7e6cd6d6e 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -569,16 +569,6 @@ \sa operator[](), remove() */ -/*! \fn template void QVarLengthArray::remove(qsizetype i) - - \overload - \since 4.8 - - Removes the element at index position \a i. - - \sa insert(), replace() -*/ - /*! \fn template void QVarLengthArray::remove(qsizetype i, qsizetype count) \overload