diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-10-16 18:46:21 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-12-01 18:55:49 +0100 |
commit | c176525f13bfcea8649d9e987bdff0dc45a56bf7 (patch) | |
tree | f7fdc911b40f305da909d1c7f10cd38339a65378 /src/corelib/tools/qvarlengtharray.qdoc | |
parent | 6025ecfaa1e4e13eab403f095946454e131ef3f4 (diff) |
Sequential general purpose containers: add erase/erase_if
This is refactor/revisit for Qt 6 of the original commit [1]
by Marc, limited to QList and QVLA.
[1] see 11aa9a2276ba5367adbbd96d0ba13111d58145f8
[ChangeLog][QtCore][QList] Added erase() and erase_if(),
for consistent container erasure. Added removeIf() as a
method, complementing removeOne() / removeAll().
[ChangeLog][QtCore][QVarLengthArray] Added erase() and erase_if(),
for consistent container erasure. Added removeIf() as a
method, complementing removeOne() / removeAll().
Change-Id: I2499504e221431ead754dd64cc8a4d4e9f116183
Done-by: Marc Mutz
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qvarlengtharray.qdoc')
-rw-r--r-- | src/corelib/tools/qvarlengtharray.qdoc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index e1abebc3f9..52261de4c6 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -921,3 +921,55 @@ Returns the hash value for \a key, using \a seed to seed the calculation. */ + +/*! \fn template <typename T, qsizetype Prealloc> template <typename AT = T> qsizetype QVarLengthArray<T, Prealloc>::removeAll(const AT &t) + \since 6.1 + + Removes all elements that compare equal to \a t from the + array. Returns the number of elements removed, if any. + + \sa removeOne() +*/ + +/*! \fn template <typename T, qsizetype Prealloc> template <typename AT = T> bool QVarLengthArray<T, Prealloc>::removeOne(const AT &t) + \since 6.1 + + Removes the first element that compares equal to \a t from the + array. Returns whether an element was, in fact, removed. + + \sa removeAll() +*/ + +/*! \fn template <typename T, qsizetype Prealloc> template <typename Predicate> qsizetype QVarLengthArray<T, Prealloc>::removeIf(Predicate pred) + \since 6.1 + + Removes all elements for which the predicate \a pred returns true + from the array. Returns the number of elements removed, if any. + + \sa removeAll() +*/ + +/*! \fn template <typename T, qsizetype Prealloc, typename AT> qsizetype erase(QVarLengthArray<T, Prealloc> &array, const AT &t) + \relates QVarLengthArray + \since 6.1 + + Removes all elements that compare equal to \a t from the + array \a array. Returns the number of elements removed, if any. + + \note \a t is not allowed to be a reference to an element inside \a + array. If you cannot be sure that this is not the case, take a copy + of \a t and call this function with the copy. + + \sa erase_if() +*/ + +/*! \fn template <typename T, qsizetype Prealloc, typename Predicate> qsizetype erase_if(QVarLengthArray<T, Prealloc> &array, Predicate pred) + \relates QVarLengthArray + \since 6.1 + + Removes all elements for which the predicate \a pred returns true + from the list \a array. Returns the number of elements removed, if + any. + + \sa erase() +*/ |