diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-08 15:34:42 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-09-12 09:12:41 +0200 |
| commit | a7b85e59931443dd33adeb02c7201c1bd1d7cd1d (patch) | |
| tree | 462e58e1a438174fa80c514ee5f25af8f3b44522 /src/corelib/kernel/qmetacontainer.cpp | |
| parent | ac493c335c5465ede7fc8bf139e5e2fac8ae522e (diff) | |
QMetaContainer: Add function to erase ranges from sequences
Change-Id: Ic51103c36d288f236106e2d3aec1401d53b97a15
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/kernel/qmetacontainer.cpp')
| -rw-r--r-- | src/corelib/kernel/qmetacontainer.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmetacontainer.cpp b/src/corelib/kernel/qmetacontainer.cpp index e11381c1bdd..93829090921 100644 --- a/src/corelib/kernel/qmetacontainer.cpp +++ b/src/corelib/kernel/qmetacontainer.cpp @@ -641,6 +641,30 @@ void QMetaSequence::eraseValueAtIterator(void *container, const void *iterator) } /*! + Returns \c true if a range between two iterators can be erased from the + container, \c false otherwise. + */ +bool QMetaSequence::canEraseRangeAtIterator() const +{ + if (d_ptr) + return d_ptr->eraseRangeAtIteratorFn; + return false; +} + +/*! + Erases the range of values between the iterators \a iterator1 and + \a iterator2 from the \a container, if possible. + + \sa canEraseValueAtIterator(), begin(), end() + */ +void QMetaSequence::eraseRangeAtIterator(void *container, const void *iterator1, + const void *iterator2) const +{ + if (canEraseRangeAtIterator()) + d_ptr->eraseRangeAtIteratorFn(container, iterator1, iterator2); +} + +/*! Returns \c true if the underlying container offers a const iterator, \c false otherwise. |
