diff options
Diffstat (limited to 'src/corelib/tools/qset.qdoc')
-rw-r--r-- | src/corelib/tools/qset.qdoc | 77 |
1 files changed, 33 insertions, 44 deletions
diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc index dace0ab8ce..4ef7a80a52 100644 --- a/src/corelib/tools/qset.qdoc +++ b/src/corelib/tools/qset.qdoc @@ -1,29 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \class QSet @@ -47,7 +23,7 @@ \snippet code/doc_src_qset.cpp 1 - Another way to insert items into the set is to use operator<<(): + Another way to insert items into the set is to use \l operator<<(): \snippet code/doc_src_qset.cpp 2 @@ -70,7 +46,7 @@ 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 \l{foreach}: + To navigate through a QSet, you can also use range-based for: \snippet code/doc_src_qset.cpp 6 @@ -110,7 +86,7 @@ initializer list \a list. */ -/*! \fn template <class T> template<typename InputIterator> QSet<T>::QSet(InputIterator first, InputIterator last) +/*! \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). @@ -275,6 +251,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() */ @@ -454,7 +435,7 @@ */ /*! - \fn template <class T> QSet<T>::insert(const T &value) + \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 @@ -554,7 +535,7 @@ \fn template <class T> QSet<T> &QSet<T>::operator|=(const QSet<T> &other) \fn template <class T> QSet<T> &QSet<T>::operator+=(const QSet<T> &other) - Same as unite(\a other). + Same as \l {unite()} {unite(\a other)}. \sa operator|(), operator&=(), operator-=() */ @@ -562,7 +543,7 @@ /*! \fn template <class T> QSet<T> &QSet<T>::operator&=(const QSet<T> &other) - Same as intersect(\a other). + Same as \l {intersect()} {intersect(\a other)}. \sa operator&(), operator|=(), operator-=() */ @@ -572,7 +553,7 @@ \overload - Same as intersect(\e{other}), if we consider \e{other} to be a set + Same as \l {intersect()} {intersect(\e{other})}, if we consider \e other to be a set that contains the singleton \a value. */ @@ -580,35 +561,36 @@ /*! \fn template <class T> QSet<T> &QSet<T>::operator-=(const QSet<T> &other) - Same as subtract(\a{other}). + Same as \l {subtract()} {subtract(\a{other})}. \sa operator-(), operator|=(), operator&=() */ /*! - \fn template <class T> QSet<T> QSet<T>::operator|(const QSet<T> &other) const - \fn template <class T> QSet<T> QSet<T>::operator+(const QSet<T> &other) const + \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) + \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 union of this set and the - \a other set. + 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<T> &other) const + \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 this set and the - \a other set. + 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<T> &other) const + \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 this set and - the \a other set, i.e., this set - \a other set. + Returns a new QSet that is the set difference of sets \a lhs and \a rhs. \sa subtract(), operator-=(), operator|(), operator&() */ @@ -905,3 +887,10 @@ 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. +*/ |