diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2021-07-08 15:32:28 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-07-22 12:28:08 +0000 |
commit | 4a2c3d11831c7d79cb19a8754c587d10928459ad (patch) | |
tree | 933da109aa03503f671a057aaa0b7121f221161f /src | |
parent | c0acb7b9577515cb455c1604a4a6a8ad15b462c7 (diff) |
QSet::erase - extend docs
Explicitly specify that calling this method for an empty set or with
an invalid iterator results in undefined behavior.
On a debug build an assert is triggered in such case, but on a release
build it will access the incorect index of an array.
Task-number: QTBUG-91736
Change-Id: Ibc3e91512a0ad9d9779a41083fedb8a91780380b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e5ec09ba868685ab2f943b39732a3cac018fedad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qset.qdoc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc index dace0ab8ce..de3c125325 100644 --- a/src/corelib/tools/qset.qdoc +++ b/src/corelib/tools/qset.qdoc @@ -275,6 +275,11 @@ internal data structure. This means that it can safely be called while iterating, and won't affect the order of items in the set. + \note The iterator \a pos \e must be valid and dereferenceable. Calling this + method on any other iterator, including its own \l end(), results in + undefined behavior. In particular, even the \l begin() iterator of an empty + set cannot be dereferenced. + \sa remove(), find() */ |