diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-05-02 17:57:21 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-11-25 22:08:09 +0100 |
commit | 3f8896d77e80f652bf1b7d3a25eb0a6be3ba4473 (patch) | |
tree | 8aabbbdad77092b44e7d485d6e6d415617682e8a /src | |
parent | 61436f24cbd8219b0442544bd8e162fb8970bfc6 (diff) |
QSet: add missing insert-with-hint
Since QHash is missing the overload, too, just ignore the hint for
now, but provide the STL-compatible signature so generic code can use
QSet as a normal sequential container.
[ChangeLog][QtCore][QSet] Added insert() overload taking an insertion
hint, for STL compatibility.
Change-Id: I9fe41877343ebff721b650fb7b9cd4e06b6608d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qset.h | 3 | ||||
-rw-r--r-- | src/corelib/tools/qset.qdoc | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h index 5f1500e747..a3e541ea5e 100644 --- a/src/corelib/tools/qset.h +++ b/src/corelib/tools/qset.h @@ -198,6 +198,9 @@ public: typedef qsizetype size_type; inline bool empty() const { return isEmpty(); } + + iterator insert(const_iterator, const T &value) { return insert(value); } + // comfort inline QSet<T> &operator<<(const T &value) { insert(value); return *this; } inline QSet<T> &operator|=(const QSet<T> &other) { unite(other); return *this; } diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc index a98ce6cb06..4f26d1678c 100644 --- a/src/corelib/tools/qset.qdoc +++ b/src/corelib/tools/qset.qdoc @@ -508,6 +508,22 @@ */ /*! + \fn QSet::insert(const_iterator it, const T &value) + \overload + \since 6.1 + + Inserts item \a value into the set, if \a value isn't already + in the set, and returns an iterator pointing at the inserted + item. + + The iterator \a it is ignored. + + This function is provided for compatibility with the STL. + + \sa operator<<(), remove(), contains() +*/ + +/*! \fn template <class T> bool QSet<T>::count() const Same as size(). |