Revision control
++ // Copyright (C) 2016 The Qt Company Ltd.
++ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
++
++ /*!
++ \class QSet
++ \inmodule QtCore
++ \brief The QSet class is a template class that provides a hash-table-based set.
++ \compares equality
++
++ \ingroup tools
++ \ingroup shared
++ \ingroup containers
++ \reentrant
++
++
++ QSet<T> is one of Qt's generic \l{container classes}, where \a T
++ specifies the type of values stored in the set. It stores values in
++ an unspecified order and provides very fast lookup of the values.
++ Internally, QSet<T> is implemented as a QHash.
++
++ Here's an example QSet with QString values:
++
++ \snippet code/doc_src_qset.cpp 0
++
++ To insert a value into the set, use insert():
++
++ \snippet code/doc_src_qset.cpp 1
++
++ Another way to insert items into the set is to use \l operator<<():
++
++ \snippet code/doc_src_qset.cpp 2
++
++ To test whether an item belongs to the set or not, use contains():
++
++ \snippet code/doc_src_qset.cpp 3
++
++ If you want to navigate through all the values stored in a QSet,
++ you can use an iterator. QSet supports both \l{Java-style
++ iterators} (QSetIterator and QMutableSetIterator) and \l{STL-style
++ iterators} (QSet::iterator and QSet::const_iterator). Here's how
++ to iterate over a QSet<QWidget *> using a Java-style iterator:
++
++ \snippet code/doc_src_qset.cpp 4
++
++ Here's the same code, but using an STL-style iterator:
++
++ \snippet code/doc_src_qset.cpp 5
++
++ QSet is unordered, so an iterator's sequence cannot be assumed to
++ be predictable. If ordering by key is required, use a QMap.
++
++ To navigate through a QSet, you can also use range-based for:
++
++ \snippet code/doc_src_qset.cpp 6
++
++ Items can be removed from the set using remove(). There is also a
++ clear() function that removes all items.
++
++ QSet's value data type must be an \l{assignable data type}. You
++ cannot, for example, store a QWidget as a value; instead, store a
++ QWidget *. In addition, the type must provide \c operator==(), and
++ there must also be a global qHash() function that returns a hash
++ value for an argument of the key's type. See the QHash
++ documentation for a list of types supported by qHash().
++
++ Internally, QSet uses a hash table to perform lookups. The hash
++ table automatically grows and shrinks to provide fast lookups
++ without wasting memory. You can still control the size of the hash
++ table by calling reserve(), if you already know approximately how
++ many elements the QSet will contain, but this isn't necessary to
++ obtain good performance. You can also call capacity() to retrieve
++ the hash table's size.
++
++ \sa QSetIterator, QMutableSetIterator, QHash, QMap
++ */
++
++ /*!
++ \fn template <class T> QSet<T>::QSet()
++
++ Constructs an empty set.
++
++ \sa clear()
++ */
++
++ /*! \fn template <class T> QSet<T>::QSet(std::initializer_list<T> list)
++ \since 5.1
++
++ Constructs a set with a copy of each of the elements in the
++ initializer list \a list.
++ */
++
++ /*! \fn template <class T> template <typename InputIterator, QtPrivate::IfIsInputIterator<InputIterator> = true> QSet<T>::QSet(InputIterator first, InputIterator last)
++ \since 5.14
++
++ Constructs a set with the contents in the iterator range [\a first, \a last).
++
++ The value type of \c InputIterator must be convertible to \c T.
++
++ \note If the range [\a first, \a last) contains duplicate elements,
++ the first one is retained.
++ */
++
++ /*!
++ \fn template <class T> void QSet<T>::swap(QSet<T> &other)
++ \memberswap{set}
++ */
++
++ /*!
++ \fn template <class T> bool QSet<T>::operator==(const QSet<T> &lhs, const QSet<T> &rhs)
++
++ Returns \c true if the \a lhs set is equal to the \a rhs set; otherwise
++ returns \c false.
++
++ Two sets are considered equal if they contain the same elements.
++
++ This function requires the value type to implement \c operator==().
++
++ \sa operator!=()
++ */
++
++ /*!
++ \fn template <class T> bool QSet<T>::operator!=(const QSet<T> &lhs, const QSet<T> &rhs)
++
++ Returns \c true if the \a lhs set is not equal to the \a rhs set; otherwise
++ returns \c false.
++
++ Two sets are considered equal if they contain the same elements.
++
++ This function requires the value type to implement \c operator==().
++
++ \sa operator==()
++ */
++
++ /*!
++ \fn template <class T> int QSet<T>::size() const
++
++ Returns the number of items in the set.
++
++ \sa isEmpty(), count()
++ */
++
++ /*!
++ \fn template <class T> bool QSet<T>::isEmpty() const
++
++ Returns \c true if the set contains no elements; otherwise returns
++ false.
++
++ \sa size()
++ */
++
++ /*!
++ \fn template <class T> int QSet<T>::capacity() const
++
++ Returns the number of buckets in the set's internal hash
++ table.
++
++ The sole purpose of this function is to provide a means of fine
++ tuning QSet's memory usage. In general, you will rarely ever need
++ to call this function. If you want to know how many items are in
++ the set, call size().
++
++ \sa reserve(), squeeze()
++ */
++
++ /*! \fn template <class T> void QSet<T>::reserve(qsizetype size)
++
++ Ensures that the set's internal hash table consists of at
++ least \a size buckets.
++
++ This function is useful for code that needs to build a huge set
++ and wants to avoid repeated reallocation. For example:
++
++ \snippet code/doc_src_qset.cpp 7
++
++ Ideally, \a size should be slightly more than the maximum number
++ of elements expected in the set. \a size doesn't have to be prime,
++ because QSet will use a prime number internally anyway. If \a size
++ is an underestimate, the worst that will happen is that the QSet
++ will be a bit slower.
++
++ In general, you will rarely ever need to call this function.
++ QSet's internal hash table automatically shrinks or grows to
++ provide good performance without wasting too much memory.
++
++ \sa squeeze(), capacity()
++ */
++
++ /*!
++ \fn template <class T> void QSet<T>::squeeze()
++
++ Reduces the size of the set's internal hash table to save
++ memory.
++
++ The sole purpose of this function is to provide a means of fine
++ tuning QSet's memory usage. In general, you will rarely ever
++ need to call this function.
++
++ \sa reserve(), capacity()
++ */
++
++ /*!
++ \fn template <class T> void QSet<T>::detach()
++
++ \internal
++
++ Detaches this set from any other sets with which it may share
++ data.
++
++ \sa isDetached()
++ */
++
++ /*! \fn template <class T> bool QSet<T>::isDetached() const
++
++ \internal
++
++ Returns \c true if the set's internal data isn't shared with any
++ other set object; otherwise returns \c false.
++
++ \sa detach()
++ */
++
++ /*!
++ \fn template <class T> void QSet<T>::setSharable(bool sharable)
++ \internal
++ */
++
++ /*!
++ \fn template <class T> void QSet<T>::clear()
++
++ Removes all elements from the set.
++
++ \sa remove()
++ */
++
++ /*!
++ \fn template <class T> bool QSet<T>::remove(const T &value)
++
++ Removes any occurrence of item \a value from the set. Returns
++ true if an item was actually removed; otherwise returns \c false.
++
++ \sa contains(), insert()
++ */
++
++ /*!
++ \fn template <class T> QSet<T>::iterator QSet<T>::erase(const_iterator pos)
++ \since 5.7
++
++ Removes the item at the iterator position \a pos from the set, and
++ returns an iterator positioned at the next item in the set.
++
++ Unlike remove(), this function never causes QSet to rehash its
++ 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()
++ */
++
++ /*! \fn template <class T> QSet<T>::const_iterator QSet<T>::find(const T &value) const
++ \since 4.2
++
++ Returns a const iterator positioned at the item \a value in the
++ set. If the set contains no item \a value, the function returns
++ constEnd().
++
++ \sa constFind(), contains()
++ */
++
++ /*! \fn template <class T> QSet<T>::iterator QSet<T>::find(const T &value)
++ \since 4.2
++ \overload
++
++ Returns a non-const iterator positioned at the item \a value in
++ the set. If the set contains no item \a value, the function
++ returns end().
++ */
++
++ /*! \fn template <class T> QSet<T>::const_iterator QSet<T>::constFind(const T &value) const
++ \since 4.2
++
++ Returns a const iterator positioned at the item \a value in the
++ set. If the set contains no item \a value, the function returns
++ constEnd().
++
++ \sa find(), contains()
++ */
++
++ /*!
++ \fn template <class T> bool QSet<T>::contains(const T &value) const
++
++ Returns \c true if the set contains item \a value; otherwise returns
++ false.
++
++ \sa insert(), remove(), find()
++ */
++
++ /*!
++ \fn template <class T> bool QSet<T>::contains(const QSet<T> &other) const
++ \since 4.6
++
++ Returns \c true if the set contains all items from the \a other set;
++ otherwise returns \c false.
++
++ \sa insert(), remove(), find()
++ */
++
++ /*! \fn template <class T> QSet<T>::const_iterator QSet<T>::begin() const
++
++ Returns a const \l{STL-style iterators}{STL-style iterator} positioned at the first
++ item in the set.
++
++ \sa constBegin(), end()
++ */
++
++ /*! \fn template <class T> QSet<T>::iterator QSet<T>::begin()
++ \since 4.2
++ \overload
++
++ Returns a non-const \l{STL-style iterators}{STL-style iterator} positioned at the first
++ item in the set.
++ */
++
++ /*! \fn template <class T> QSet<T>::const_iterator QSet<T>::cbegin() const
++ \since 5.0
++
++ Returns a const \l{STL-style iterators}{STL-style iterator} positioned at the first
++ item in the set.
++
++ \sa begin(), cend()
++ */
++
++ /*! \fn template <class T> QSet<T>::const_iterator QSet<T>::constBegin() const
++
++ Returns a const \l{STL-style iterators}{STL-style iterator} positioned at the first
++ item in the set.
++
++ \sa begin(), constEnd()
++ */
++
++ /*! \fn template <class T> QSet<T>::const_iterator QSet<T>::end() const
++
++ Returns a const \l{STL-style iterators}{STL-style iterator} positioned at the imaginary
++ item after the last item in the set.
++
++ \sa constEnd(), begin()
++ */
++
++ /*! \fn template <class T> QSet<T>::iterator QSet<T>::end()
++ \since 4.2
++ \overload
++
++ Returns a non-const \l{STL-style iterators}{STL-style iterator} pointing to the
++ imaginary item after the last item in the set.
++ */
++
++ /*! \fn template <class T> QSet<T>::const_iterator QSet<T>::cend() const
++ \since 5.0
++
++ Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
++ item after the last item in the set.
++
++ \sa cbegin(), end()
++ */
++
++ /*! \fn template <class T> QSet<T>::const_iterator QSet<T>::constEnd() const
++
++ Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
++ item after the last item in the set.
++
++ \sa constBegin(), end()
++ */
++
++ /*!
++ \typedef QSet::Iterator
++ \since 4.2
++
++ Qt-style synonym for QSet::iterator.
++ */
++
++ /*!
++ \typedef QSet::ConstIterator
++
++ Qt-style synonym for QSet::const_iterator.
++ */
++
++ /*!
++ \typedef QSet::const_pointer
++
++ Typedef for const T *. Provided for STL compatibility.
++ */
++
++ /*!
++ \typedef QSet::const_reference
++
++ Typedef for const T &. Provided for STL compatibility.
++ */
++
++ /*!
++ \typedef QSet::difference_type
++
++ Typedef for const ptrdiff_t. Provided for STL compatibility.
++ */
++
++ /*!
++ \typedef QSet::key_type
++
++ Typedef for T. Provided for STL compatibility.
++ */
++
++ /*!
++ \typedef QSet::pointer
++
++ Typedef for T *. Provided for STL compatibility.
++ */
++
++ /*!
++ \typedef QSet::reference
++
++ Typedef for T &. Provided for STL compatibility.
++ */
++
++ /*!
++ \typedef QSet::size_type
++
++ Typedef for int. Provided for STL compatibility.
++ */
++
++ /*!
++ \typedef QSet::value_type
++
++ Typedef for T. Provided for STL compatibility.
++ */
++
++ /*!
++ \fn template <class T> QSet<T>::iterator QSet<T>::insert(const T &value)
++
++ 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.
++
++ \sa operator<<(), remove(), contains()
++ */
++
++ /*!
++ \fn template <class T> QSet<T>::iterator QSet<T>::insert(T &&value)
++ \overload
++ \since 6.1
++ */
++
++ /*!
++ \fn template <class T> QSet<T> &QSet<T>::unite(const QSet<T> &other)
++ \fn template <class T> QSet<T> &QSet<T>::unite(QSet &&other)
++
++ Each item in the \a other set that isn't already in this set is
++ inserted into this set. A reference to this set is returned.
++
++ \sa operator|=(), intersect(), subtract()
++ */
++
++ /*!
++ \fn template <class T> QSet<T> &QSet<T>::intersect(const QSet<T> &other)
++
++ Removes all items from this set that are not contained in the
++ \a other set. A reference to this set is returned.
++
++ \sa intersects(), operator&=(), unite(), subtract()
++ */
++
++ /*!
++ \fn template <class T> bool QSet<T>::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()
++ */
++
++ /*!
++ \fn template <class T> QSet<T> &QSet<T>::subtract(const QSet<T> &other)
++
++ Removes all items from this set that are contained in the
++ \a other set. Returns a reference to this set.
++
++ \sa operator-=(), unite(), intersect()
++ */
++
++ /*!
++ \fn template <class T> bool QSet<T>::empty() const
++
++ Returns \c true if the set is empty. This function is provided
++ for STL compatibility. It is equivalent to isEmpty().
++ */
++
++ /*!
++ \fn template <class T> QSet<T>::iterator QSet<T>::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> QSet<T>::iterator QSet<T>::insert(const_iterator it, T &&value)
++ \overload
++ \since 6.12
++ */
++
++ /*!
++ \fn template <class T> bool QSet<T>::count() const
++
++ Same as size().
++ */
++
++ /*!
++ \fn template <class T> QSet<T> &QSet<T>::operator<<(const T &value)
++ \fn template <class T> QSet<T> &QSet<T>::operator+=(const T &value)
++ \fn template <class T> QSet<T> &QSet<T>::operator|=(const T &value)
++
++ Inserts a new item \a value and returns a reference to the set.
++ If \a value already exists in the set, the set is left unchanged.
++
++ \sa insert()
++ */
++
++ /*!
++ \fn template <class T> QSet<T> &QSet<T>::operator-=(const T &value)
++
++ Removes the occurrence of item \a value from the set, if
++ it is found, and returns a reference to the set. If the
++ \a value is not contained the set, nothing is removed.
++
++ \sa remove()
++ */
++
++ /*!
++ \fn template <class T> QSet<T> &QSet<T>::operator|=(const QSet<T> &other)
++ \fn template <class T> QSet<T> &QSet<T>::operator|=(QSet &&other)
++ \fn template <class T> QSet<T> &QSet<T>::operator+=(const QSet<T> &other)
++ \fn template <class T> QSet<T> &QSet<T>::operator+=(QSet &&other)
++
++ Same as \l {unite()} {unite(\a other)}.
++
++ \sa operator|(), operator&=(), operator-=()
++ */
++
++ /*!
++ \fn template <class T> QSet<T> &QSet<T>::operator&=(const QSet<T> &other)
++
++ Same as \l {intersect()} {intersect(\a other)}.
++
++ \sa operator&(), operator|=(), operator-=()
++ */
++
++ /*!
++ \fn template <class T> QSet<T> &QSet<T>::operator&=(const T &value)
++
++ \overload
++
++ Same as \l {intersect()} {intersect(\e{other})}, if we consider \e other to be a set
++ that contains the singleton \a value.
++ */
++
++
++ /*!
++ \fn template <class T> QSet<T> &QSet<T>::operator-=(const QSet<T> &other)
++
++ Same as \l {subtract()} {subtract(\a{other})}.
++
++ \sa operator-(), operator|=(), operator&=()
++ */
++
++ /*!
++ \fn template <class T> QSet<T> QSet<T>::operator|(const QSet &lhs, const QSet &rhs)
++ \fn template <class T> QSet<T> QSet<T>::operator|(const QSet &lhs, QSet &&rhs)
++ \fn template <class T> QSet<T> QSet<T>::operator|(QSet &&lhs, const QSet &rhs)
++ \fn template <class T> QSet<T> QSet<T>::operator|(QSet &&lhs, QSet &&rhs)
++ \fn template <class T> QSet<T> QSet<T>::operator+(const QSet &lhs, const QSet &rhs)
++ \fn template <class T> QSet<T> QSet<T>::operator+(const QSet &lhs, QSet &&rhs)
++ \fn template <class T> QSet<T> QSet<T>::operator+(QSet &&lhs, const QSet &rhs)
++ \fn template <class T> QSet<T> QSet<T>::operator+(QSet &&lhs, QSet &&rhs)
++
++ Returns a new QSet that is the union of sets \a lhs and \a rhs.
++
++ \sa unite(), operator|=(), operator&(), operator-()
++ */
++
++ /*!
++ \fn template <class T> QSet<T> QSet<T>::operator&(const QSet &lhs, const QSet &rhs)
++ \fn template <class T> QSet<T> QSet<T>::operator&(QSet &&lhs, const QSet &rhs)
++
++ Returns a new QSet that is the intersection of sets \a lhs and \a rhs.
++
++ \sa intersect(), operator&=(), operator|(), operator-()
++ */
++
++ /*!
++ \fn template <class T> QSet<T> QSet<T>::operator-(const QSet &lhs, const QSet &rhs)
++ \fn template <class T> QSet<T> QSet<T>::operator-(QSet &&lhs, const QSet &rhs)
++
++ Returns a new QSet that is the set difference of sets \a lhs and \a rhs.
++
++ \sa subtract(), operator-=(), operator|(), operator&()
++ */
++
++ /*!
++ \class QSet::iterator
++ \inmodule QtCore
++ \since 4.2
++ \brief The QSet::iterator class provides an STL-style non-const iterator for QSet.
++
++ QSet features both \l{STL-style iterators} and
++ \l{Java-style iterators}. The STL-style iterators are more
++ low-level and more cumbersome to use; on the other hand, they are
++ slightly faster and, for developers who already know STL, have
++ the advantage of familiarity.
++
++ QSet<T>::iterator allows you to iterate over a QSet and to remove
++ items (using QSet::erase()) while you iterate. (QSet doesn't let
++ you \e modify a value through an iterator, because that
++ would potentially require moving the value in the internal hash
++ table used by QSet.) If you want to iterate over a const QSet,
++ you should use QSet::const_iterator. It is generally good
++ practice to use QSet::const_iterator on a non-const QSet as well,
++ unless you need to change the QSet through the iterator. Const
++ iterators are slightly faster, and can improve code readability.
++
++ The default QSet::iterator constructor creates an uninitialized
++ iterator. You must initialize it using a function like
++ QSet::begin(), QSet::end(), or QSet::insert() before you can
++ start iterating. Here's a typical loop that prints all the items
++ stored in a set:
++
++ \snippet code/doc_src_qset.cpp 8
++
++ Here's a loop that removes certain items (all those that start
++ with 'J') from a set while iterating:
++
++ \snippet code/doc_src_qset.cpp 9
++
++ STL-style iterators can be used as arguments to \l{generic
++ algorithms}. For example, here's how to find an item in the set
++ using the qFind() algorithm:
++
++ \snippet code/doc_src_qset.cpp 10
++
++ Multiple iterators can be used on the same set.
++
++ \warning Iterators on implicitly shared containers do not work
++ exactly like STL-iterators. You should avoid copying a container
++ while iterators are active on that container. For more information,
++ read \l{Implicit sharing iterator problem}.
++
++ \sa QSet::const_iterator, QMutableSetIterator
++ */
++
++ /*!
++ \class QSet::const_iterator
++ \inmodule QtCore
++ \brief The QSet::const_iterator class provides an STL-style const iterator for QSet.
++ \since 4.2
++
++ QSet features both \l{STL-style iterators} and
++ \l{Java-style iterators}. The STL-style iterators are more
++ low-level and more cumbersome to use; on the other hand, they are
++ slightly faster and, for developers who already know STL, have
++ the advantage of familiarity.
++
++ QSet\<Key, T\>::const_iterator allows you to iterate over a QSet.
++ If you want to modify the QSet as you iterate over it, you must
++ use QSet::iterator instead. It is generally good practice to use
++ QSet::const_iterator on a non-const QSet as well, unless you need
++ to change the QSet through the iterator. Const iterators are
++ slightly faster, and can improve code readability.
++
++ The default QSet::const_iterator constructor creates an
++ uninitialized iterator. You must initialize it using a function
++ like QSet::begin(), QSet::end(), or QSet::insert() before you can
++ start iterating. Here's a typical loop that prints all the items
++ stored in a set:
++
++ \snippet code/doc_src_qset.cpp 11
++
++ STL-style iterators can be used as arguments to \l{generic
++ algorithms}. For example, here's how to find an item in the set
++ using the qFind() algorithm:
++
++ \snippet code/doc_src_qset.cpp 12
++
++ \warning Iterators on implicitly shared containers do not work
++ exactly like STL-iterators. You should avoid copying a container
++ while iterators are active on that container. For more information,
++ read \l{Implicit sharing iterator problem}.
++
++ \sa QSet::iterator, QSetIterator
++ */
++
++ /*!
++ \fn template <class T> QSet<T>::iterator::iterator()
++ \fn template <class T> QSet<T>::const_iterator::const_iterator()
++
++ Constructs an uninitialized iterator.
++
++ Functions like operator*() and operator++() should not be called
++ on an uninitialized iterator. Use operator=() to assign a value
++ to it before using it.
++
++ \sa QSet::begin(), QSet::end()
++ */
++
++ /*!
++ \fn template <class T> QSet<T>::iterator::iterator(typename Hash::iterator i)
++ \fn template <class T> QSet<T>::const_iterator::const_iterator(typename Hash::const_iterator i)
++
++ \internal
++ */
++
++ /*!
++ \typedef QSet::iterator::iterator_category
++ \typedef QSet::const_iterator::iterator_category
++
++ Synonyms for \e {std::bidirectional_iterator_tag} indicating
++ these iterators are bidirectional iterators.
++ */
++
++ /*!
++ \typedef QSet::iterator::difference_type
++ \typedef QSet::const_iterator::difference_type
++
++ \internal
++ */
++
++ /*!
++ \typedef QSet::iterator::value_type
++ \typedef QSet::const_iterator::value_type
++
++ \internal
++ */
++
++ /*!
++ \typedef QSet::iterator::pointer
++ \typedef QSet::const_iterator::pointer
++
++ \internal
++ */
++
++ /*!
++ \typedef QSet::iterator::reference
++ \typedef QSet::const_iterator::reference
++
++ \internal
++ */
++
++ /*!
++ \fn template <class T> QSet<T>::iterator::iterator(const iterator &other)
++ \fn template <class T> QSet<T>::const_iterator::const_iterator(const const_iterator &other)
++
++ Constructs a copy of \a other.
++ */
++
++ /*!
++ \fn template <class T> QSet<T>::const_iterator::const_iterator(const iterator &other)
++ \since 4.2
++ \overload
++
++ Constructs a copy of \a other.
++ */
++
++ /*!
++ \fn template <class T> QSet<T>::iterator &QSet<T>::iterator::operator=(const iterator &other)
++ \fn template <class T> QSet<T>::const_iterator &QSet<T>::const_iterator::operator=(const const_iterator &other)
++
++ Assigns \a other to this iterator.
++ */
++
++ /*!
++ \fn template <class T> const T &QSet<T>::iterator::operator*() const
++ \fn template <class T> const T &QSet<T>::const_iterator::operator*() const
++
++ Returns a reference to the current item.
++
++ \sa operator->()
++ */
++
++ /*!
++ \fn template <class T> const T *QSet<T>::iterator::operator->() const
++ \fn template <class T> const T *QSet<T>::const_iterator::operator->() const
++
++ Returns a pointer to the current item.
++
++ \sa operator*()
++ */
++
++ /*!
++ \fn template <class T> bool QSet<T>::iterator::operator==(const iterator &other) const
++ \fn template <class T> bool QSet<T>::const_iterator::operator==(const const_iterator &other) const
++
++ Returns \c true if \a other points to the same item as this
++ iterator; otherwise returns \c false.
++
++ \sa operator!=()
++ */
++
++ /*!
++ \fn template <class T> bool QSet<T>::iterator::operator==(const const_iterator &other) const
++ \fn template <class T> bool QSet<T>::iterator::operator!=(const const_iterator &other) const
++
++ \overload
++ */
++
++ /*!
++ \fn template <class T> bool QSet<T>::iterator::operator!=(const iterator &other) const
++ \fn template <class T> bool QSet<T>::const_iterator::operator!=(const const_iterator &other) const
++
++ Returns \c true if \a other points to a different item than this
++ iterator; otherwise returns \c false.
++
++ \sa operator==()
++ */
++
++ /*!
++ \fn template <class T> QSet<T>::iterator &QSet<T>::iterator::operator++()
++ \fn template <class T> QSet<T>::const_iterator &QSet<T>::const_iterator::operator++()
++
++ The prefix ++ operator (\c{++it}) advances the iterator to the
++ next item in the set and returns an iterator to the new current
++ item.
++
++ Calling this function on QSet<T>::constEnd() leads to
++ undefined results.
++ */
++
++ /*!
++ \fn template <class T> QSet<T>::iterator QSet<T>::iterator::operator++(int)
++ \fn template <class T> QSet<T>::const_iterator QSet<T>::const_iterator::operator++(int)
++
++ \overload
++
++ The postfix ++ operator (\c{it++}) advances the iterator to the
++ next item in the set and returns an iterator to the previously
++ current item.
++ */
++
++ /*!
++ \fn template <class T> QList<T> QSet<T>::values() const &
++
++ Returns a new QList containing the elements in the set. The
++ order of the elements in the QList is undefined.
++
++ \include containers-range-constructor.qdocinc
++
++ This function creates a new list, in \l {linear time}. The time and memory
++ use that entails can be avoided by iterating from \l constBegin() to
++ \l constEnd().
++ */
++
++ /*!
++ \fn template <class T> QList<T> QSet<T>::values() &&
++ \since 6.12
++ \overload
++ */
++
++ /*!
++ \fn template <class T> QDataStream &operator<<(QDataStream &out, const QSet<T> &set)
++ \relates QSet
++
++ Writes the \a set to stream \a out.
++
++ This function requires the value type to implement \c operator<<().
++
++ \sa{Serializing Qt Data Types}{Format of the QDataStream operators}
++ */
++
++ /*!
++ \fn template <class T> QDataStream &operator>>(QDataStream &in, QSet<T> &set)
++ \relates QSet
++
++ Reads a set from stream \a in into \a set.
++
++ This function requires the value type to implement \c operator>>().
++
++ \sa{Serializing Qt Data Types}{Format of the QDataStream operators}
++ */
++
++ /*!
++ \fn template <class T> size_t qHash(const QSet<T> &key, size_t seed = 0)
++ \qhasholdT{QHash}{T}
++ \since 5.5
++
++ The hash value is independent of the order of elements in \a key, that is, sets
++ that contain the same elements hash to the same value.
++ */
++
++ /*! \fn template <class T, class Predicate> qsizetype erase_if(QSet<T> &set, Predicate pred)
++ \relates QSet
++ \since 6.1
++
++ Removes all elements for which the predicate \a pred returns true
++ from the set \a set. Returns the number of elements removed, if
++ any.
++ */
++
++ /*! \fn template <class T> template <class Pred> qsizetype QSet<T>::removeIf(Pred pred)
++ \since 6.1
++
++ Removes, from this set, all elements for which the predicate \a pred
++ returns \c true. Returns the number of elements removed, if any.
++ */