diff options
author | Sérgio Martins <sergio.martins@kdab.com> | 2015-05-25 18:32:35 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-05-30 07:15:24 +0000 |
commit | 9eff0dd19d6507ec400f036dd27efe960e4e5f78 (patch) | |
tree | ed9cd2e3bffc0df9e6fcbb1daa4b52210aec347b /src/corelib/tools/qset.qdoc | |
parent | fda08f3971e854ad1623fb99212746143c27e412 (diff) |
QSet: Introduce intersects().
The pattern "mySet.intersect(other).isEmpty()" has been spotted in
the wild and in Qt codebase. intersects() is much cheaper because it
bails out as soon as we find one common item and doesn't do any
allocations.
[ChangeLog][QtCore][QSet] Added intersects().
Change-Id: I44a350dc4cdb9deb835a23eee99fc99d6ca24c82
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/tools/qset.qdoc')
-rw-r--r-- | src/corelib/tools/qset.qdoc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc index 94cfa729f5..c4f33deed6 100644 --- a/src/corelib/tools/qset.qdoc +++ b/src/corelib/tools/qset.qdoc @@ -490,7 +490,17 @@ Removes all items from this set that are not contained in the \a other set. A reference to this set is returned. - \sa operator&=(), unite(), subtract() + \sa intersects(), operator&=(), unite(), subtract() +*/ + +/*! + \fn bool QSet::intersects(const QSet<T> &other) const + \since 5.6 + + Returns \c true if this set has at least one item in common with + \a other. + + \sa contains(), intersect() */ /*! |