diff options
Diffstat (limited to 'src/corelib/tools/qalgorithms.qdoc')
-rw-r--r-- | src/corelib/tools/qalgorithms.qdoc | 62 |
1 files changed, 6 insertions, 56 deletions
diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index f94a6856da..5fe0b3e8c3 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -1,32 +1,9 @@ -/**************************************************************************** -** -** 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 /*! \headerfile <QtAlgorithms> + \inmodule QtCore \title Generic Algorithms \ingroup funclists \keyword generic algorithms @@ -47,8 +24,7 @@ meet a certain set of requirements. Different algorithms can have different requirements for the - iterators they accept. For example, qFill() accepts two - \l {forward iterators}. The iterator types required are specified + iterators they accept. The iterator types required are specified for each algorithm. If an iterator of the wrong type is passed (for example, if QList::ConstIterator is passed as an \l {Output Iterators}{output iterator}), you will always get a @@ -63,21 +39,7 @@ The generic algorithms can be used on other container classes than those provided by Qt and STL. The syntax of STL-style iterators is modeled after C++ pointers, so it's possible to use - plain arrays as containers and plain pointers as iterators. A - common idiom is to use qBinaryFind() together with two static - arrays: one that contains a list of keys, and another that - contains a list of associated values. For example, the following - code will look up an HTML entity (e.g., \c &) in the \c - name_table array and return the corresponding Unicode value from - the \c value_table if the entity is recognized: - - \snippet code/doc_src_qalgorithms.cpp 2 - - This kind of code is for advanced users only; for most - applications, a QMap- or QHash-based approach would work just as - well: - - \snippet code/doc_src_qalgorithms.cpp 3 + plain arrays as containers and plain pointers as iterators. \section1 Types of Iterators @@ -147,18 +109,6 @@ \sa {container classes}, <QtGlobal> */ -/*! \fn template <typename T> void qSwap(T &var1, T &var2) - \relates <QtAlgorithms> - \deprecated - - Use \c std::swap instead. - - Exchanges the values of variables \a var1 and \a var2. - - Example: - \snippet code/doc_src_qalgorithms.cpp 10 -*/ - /*! \fn template <typename ForwardIterator> void qDeleteAll(ForwardIterator begin, ForwardIterator end) \relates <QtAlgorithms> @@ -168,7 +118,7 @@ example, \c{QWidget *}). Example: - \snippet code/doc_src_qalgorithms.cpp 23 + \snippet code/doc_src_qalgorithms.cpp 1 Notice that qDeleteAll() doesn't remove the items from the container; it merely calls \c delete on them. In the example |