summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mkspecs/features/qt_build_config.prf4
-rw-r--r--src/concurrent/doc/src/qtconcurrent-index.qdoc2
-rw-r--r--src/corelib/.prev_CMakeLists.txt1
-rw-r--r--src/corelib/CMakeLists.txt1
-rw-r--r--src/corelib/doc/snippets/code/doc_src_containers.cpp16
-rw-r--r--src/corelib/doc/snippets/code/doc_src_qiterator.cpp71
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp8
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp214
-rw-r--r--src/corelib/doc/src/containers.qdoc37
-rw-r--r--src/corelib/doc/src/datastreamformat.qdoc1
-rw-r--r--src/corelib/doc/src/dontdocument.qdoc2
-rw-r--r--src/corelib/kernel/qmetatype.cpp2
-rw-r--r--src/corelib/serialization/qcborstreamwriter.cpp4
-rw-r--r--src/corelib/serialization/qdatastream.cpp2
-rw-r--r--src/corelib/tools/qalgorithms.qdoc2
-rw-r--r--src/corelib/tools/qcontainerfwd.h3
-rw-r--r--src/corelib/tools/qiterator.qdoc163
-rw-r--r--src/corelib/tools/qlinkedlist.cpp1238
-rw-r--r--src/corelib/tools/qlinkedlist.h612
-rw-r--r--src/corelib/tools/qvarlengtharray.qdoc7
-rw-r--r--src/corelib/tools/qvector.qdoc17
-rw-r--r--src/corelib/tools/tools.pri2
-rw-r--r--src/plugins/platforms/xcb/qxcbeventqueue.cpp4
-rw-r--r--src/tools/qlalr/lalr.h1
-rw-r--r--src/tools/uic/qclass_lib_map.h7
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp1
-rw-r--r--tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro1
-rw-r--r--tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp654
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro1
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp726
-rw-r--r--tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp1
-rw-r--r--tests/auto/corelib/kernel/qmetatype/qmetatype.pro1
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp1
-rw-r--r--tests/auto/corelib/kernel/qvariant/qvariant.pro1
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp8
-rw-r--r--tests/auto/corelib/serialization/qdatastream/qdatastream.pro2
-rw-r--r--tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp24
-rw-r--r--tests/auto/corelib/tools/CMakeLists.txt1
-rw-r--r--tests/auto/corelib/tools/collections/collections.pro1
-rw-r--r--tests/auto/corelib/tools/collections/tst_collections.cpp278
-rw-r--r--tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro2
-rw-r--r--tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp10
-rw-r--r--tests/auto/corelib/tools/qlinkedlist/.prev_CMakeLists.txt15
-rw-r--r--tests/auto/corelib/tools/qlinkedlist/CMakeLists.txt15
-rw-r--r--tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro7
-rw-r--r--tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp1072
-rw-r--r--tests/auto/corelib/tools/tools.pro1
47 files changed, 43 insertions, 5201 deletions
diff --git a/mkspecs/features/qt_build_config.prf b/mkspecs/features/qt_build_config.prf
index 8273ba3fe1..9aa0a4aadc 100644
--- a/mkspecs/features/qt_build_config.prf
+++ b/mkspecs/features/qt_build_config.prf
@@ -111,10 +111,6 @@ macos: CONFIG += testcase_no_bundle
# Override MinGW's definition in _mingw.h
mingw: DEFINES += WINVER=0x0601 _WIN32_WINNT=0x0601
-# By default, the following features should not be used in Qt's own
-# implementation, so declare them invisible to Qt modules.
-DEFINES += QT_NO_LINKED_LIST # QLinkedList
-
defineTest(qtBuildPart) {
bp = $$eval($$upper($$section(_QMAKE_CONF_, /, -2, -2))_BUILD_PARTS)
isEmpty(bp): bp = $$QT_BUILD_PARTS
diff --git a/src/concurrent/doc/src/qtconcurrent-index.qdoc b/src/concurrent/doc/src/qtconcurrent-index.qdoc
index 3e4aa791f1..eb5cd334dd 100644
--- a/src/concurrent/doc/src/qtconcurrent-index.qdoc
+++ b/src/concurrent/doc/src/qtconcurrent-index.qdoc
@@ -115,7 +115,7 @@
\li Supported
\row
\li Bidirectional Iterator
- \li QLinkedList, std::list
+ \li std::list
\li Supported
\row
\li Random Access Iterator
diff --git a/src/corelib/.prev_CMakeLists.txt b/src/corelib/.prev_CMakeLists.txt
index 78b9c17b3f..4835ee8b0d 100644
--- a/src/corelib/.prev_CMakeLists.txt
+++ b/src/corelib/.prev_CMakeLists.txt
@@ -201,7 +201,6 @@ qt_add_module(Core
tools/qhashfunctions.h
tools/qiterator.h
tools/qline.cpp tools/qline.h
- tools/qlinkedlist.cpp tools/qlinkedlist.h
tools/qlist.cpp tools/qlist.h
tools/qmakearray_p.h
tools/qmap.cpp tools/qmap.h
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index 42b2b38502..e7bea8f3bf 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -219,7 +219,6 @@ qt_add_module(Core
tools/qhashfunctions.h
tools/qiterator.h
tools/qline.cpp tools/qline.h
- tools/qlinkedlist.cpp tools/qlinkedlist.h
tools/qlist.cpp tools/qlist.h
tools/qmakearray_p.h
tools/qmap.cpp tools/qmap.h
diff --git a/src/corelib/doc/snippets/code/doc_src_containers.cpp b/src/corelib/doc/snippets/code/doc_src_containers.cpp
index 84935580c9..9b23a9056c 100644
--- a/src/corelib/doc/snippets/code/doc_src_containers.cpp
+++ b/src/corelib/doc/snippets/code/doc_src_containers.cpp
@@ -205,35 +205,35 @@ for (i = splitter->sizes().begin();
//! [15]
-QLinkedList<QString> list;
+QVector<QString> values;
...
QString str;
-foreach (str, list)
+foreach (str, values)
qDebug() << str;
//! [15]
//! [16]
-QLinkedList<QString> list;
+QVector<QString> values;
...
-QLinkedListIterator<QString> i(list);
+QVectorIterator<QString> i(values);
while (i.hasNext())
qDebug() << i.next();
//! [16]
//! [17]
-QLinkedList<QString> list;
+QVector<QString> values;
...
-foreach (const QString &str, list)
+foreach (const QString &str, values)
qDebug() << str;
//! [17]
//! [18]
-QLinkedList<QString> list;
+QVector<QString> values;
...
-foreach (const QString &str, list) {
+foreach (const QString &str, values) {
if (str.isEmpty())
break;
qDebug() << str;
diff --git a/src/corelib/doc/snippets/code/doc_src_qiterator.cpp b/src/corelib/doc/snippets/code/doc_src_qiterator.cpp
index 58f4166c3e..0d0b864a83 100644
--- a/src/corelib/doc/snippets/code/doc_src_qiterator.cpp
+++ b/src/corelib/doc/snippets/code/doc_src_qiterator.cpp
@@ -64,24 +64,6 @@ while (i.hasPrevious())
qDebug() << i.previous();
//! [1]
-
-//! [2]
-QLinkedList<float> list;
-...
-QLinkedListIterator<float> i(list);
-while (i.hasNext())
- qDebug() << i.next();
-//! [2]
-
-
-//! [3]
-QLinkedListIterator<float> i(list);
-i.toBack();
-while (i.hasPrevious())
- qDebug() << i.previous();
-//! [3]
-
-
//! [4]
QVector<float> vector;
...
@@ -145,37 +127,6 @@ while (i.hasNext()) {
}
//! [10]
-
-//! [11]
-QLinkedList<float> list;
-...
-QMutableLinkedListIterator<float> i(list);
-while (i.hasNext())
- qDebug() << i.next();
-//! [11]
-
-
-//! [12]
-QMutableLinkedListIterator<float> i(list);
-i.toBack();
-while (i.hasPrevious())
- qDebug() << i.previous();
-//! [12]
-
-
-//! [13]
-QMutableLinkedListIterator<int> i(list);
-while (i.hasNext()) {
- int val = i.next();
- if (val < 0) {
- i.setValue(-val);
- } else if (val == 0) {
- i.remove();
- }
-}
-//! [13]
-
-
//! [14]
QVector<float> vector;
...
@@ -184,7 +135,6 @@ while (i.hasNext())
qDebug() << i.next();
//! [14]
-
//! [15]
QMutableVectorIterator<float> i(vector);
i.toBack();
@@ -232,17 +182,6 @@ while (i.hasNext()) {
}
//! [19]
-
-//! [20]
-QMutableLinkedListIterator<int> i(list);
-while (i.hasNext()) {
- int val = i.next();
- if (val < -32768 || val > 32767)
- i.remove();
-}
-//! [20]
-
-
//! [21]
QMutableVectorIterator<int> i(vector);
while (i.hasNext()) {
@@ -271,16 +210,6 @@ while (i.hasNext()) {
}
//! [23]
-
-//! [24]
-QMutableLinkedListIterator<double> i(list);
-while (i.hasNext()) {
- double val = i.next();
- i.setValue(std::sqrt(val));
-}
-//! [24]
-
-
//! [25]
QMutableVectorIterator<double> i(list);
while (i.hasNext()) {
diff --git a/src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp b/src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp
index 6ddb5a9365..973ae75847 100644
--- a/src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_serialization_qcborstream.cpp
@@ -208,10 +208,10 @@
//! [19]
//! [20]
- void appendList(QCborStreamWriter &writer, const QLinkedList<QString> &list)
+ void appendList(QCborStreamWriter &writer, const QVector<QString> &values)
{
writer.startArray();
- for (const QString &s : list)
+ for (const QString &s : values)
writer.append(s);
writer.endArray();
}
@@ -228,10 +228,10 @@
//! [21]
//! [22]
- void appendMap(QCborStreamWriter &writer, const QLinkedList<QPair<int, QString>> &list)
+ void appendMap(QCborStreamWriter &writer, const QVector<QPair<int, QString>> &values)
{
writer.startMap();
- for (const auto pair : list) {
+ for (const auto pair : values) {
writer.append(pair.first)
writer.append(pair.second);
}
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp
deleted file mode 100644
index e8754a5f34..0000000000
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qlinkedlist.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/****************************************************************************
-**
-** 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:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QLinkedList<int> integerList;
-QLinkedList<QTime> timeList;
-//! [0]
-
-
-//! [1]
-QLinkedList<QString> list;
-list << "one" << "two" << "three";
-// list: ["one", "two", "three"]
-//! [1]
-
-
-//! [2]
-QLinkedList<QWidget *> list;
-...
-while (!list.isEmpty())
- delete list.takeFirst();
-//! [2]
-
-
-//! [3]
-QLinkedList<QString> list;
-list.append("one");
-list.append("two");
-list.append("three");
-// list: ["one", "two", "three"]
-//! [3]
-
-
-//! [4]
-QLinkedList<QString> list;
-list.prepend("one");
-list.prepend("two");
-list.prepend("three");
-// list: ["three", "two", "one"]
-//! [4]
-
-
-//! [5]
-QList<QString> list;
-list << "sun" << "cloud" << "sun" << "rain";
-list.removeAll("sun");
-// list: ["cloud", "rain"]
-//! [5]
-
-
-//! [6]
-QList<QString> list;
-list << "sun" << "cloud" << "sun" << "rain";
-list.removeOne("sun");
-// list: ["cloud", "sun", "rain"]
-//! [6]
-
-
-//! [7]
-QLinkedList<QString> list;
-list.append("January");
-list.append("February");
-...
-list.append("December");
-
-QLinkedList<QString>::iterator i;
-for (i = list.begin(); i != list.end(); ++i)
- cout << *i << Qt::endl;
-//! [7]
-
-
-//! [8]
-QLinkedList<QString> list;
-...
-QLinkedList<QString>::iterator it = std::find(list.begin(),
- list.end(), "Joel");
-if (it != list.end())
- cout << "Found Joel" << Qt::endl;
-//! [8]
-
-
-//! [9]
-QLinkedList<int>::iterator i;
-for (i = list.begin(); i != list.end(); ++i)
- *i += 2;
-//! [9]
-
-
-//! [10]
-QLinkedList<QString> list;
-...
-QLinkedList<QString>::iterator i = list.begin();
-while (i != list.end()) {
- if ((*i).startsWith('_'))
- i = list.erase(i);
- else
- ++i;
-}
-//! [10]
-
-
-//! [11]
-QLinkedList<QString>::iterator i = list.begin();
-while (i != list.end()) {
- QLinkedList<QString>::iterator previous = i;
- ++i;
- if ((*previous).startsWith('_'))
- list.erase(previous);
-}
-//! [11]
-
-
-//! [12]
-// WRONG
-while (i != list.end()) {
- if ((*i).startsWith('_'))
- list.erase(i);
- ++i;
-}
-//! [12]
-
-
-//! [13]
-if (*it == "Hello")
- *it = "Bonjour";
-//! [13]
-
-
-//! [14]
-QLinkedList<QString> list;
-list.append("January");
-list.append("February");
-...
-list.append("December");
-
-QLinkedList<QString>::const_iterator i;
-for (i = list.constBegin(); i != list.constEnd(); ++i)
- cout << *i << Qt::endl;
-//! [14]
-
-
-//! [15]
-QLinkedList<QString> list;
-...
-QLinkedList<QString>::const_iterator it = std::find(list.constBegin(),
- list.constEnd(), "Joel");
-if (it != list.constEnd())
- cout << "Found Joel" << Qt::endl;
-//! [15]
-
-
-//! [16]
-std::list<double> stdlist;
-list.push_back(1.2);
-list.push_back(0.5);
-list.push_back(3.14);
-
-QLinkedList<double> list = QLinkedList<double>::fromStdList(stdlist);
-//! [16]
-
-
-//! [17]
-QLinkedList<double> list;
-list << 1.2 << 0.5 << 3.14;
-
-std::list<double> stdlist = list.toStdList();
-//! [17]
diff --git a/src/corelib/doc/src/containers.qdoc b/src/corelib/doc/src/containers.qdoc
index 8373ad4b4e..61bce214be 100644
--- a/src/corelib/doc/src/containers.qdoc
+++ b/src/corelib/doc/src/containers.qdoc
@@ -75,9 +75,9 @@
\section1 The Container Classes
Qt provides the following sequential containers: QVector,
- QLinkedList, QStack, and QQueue. For most
+ QStack, and QQueue. For most
applications, QVector is the best type to use. It provides very fast
- appends. If you really need a linked-list, use QLinkedList.
+ appends. If you really need a linked-list, use std::list.
QStack and QQueue are convenience classes that provide LIFO and
FIFO semantics.
@@ -93,14 +93,6 @@
\table
\header \li Class \li Summary
- \row \li \l{QLinkedList}<T>
- \li This class implements a doubly linked list. It
- provides better performance than QVector when inserting in the
- middle of a huge list, and it has nicer iterator semantics.
- (Iterators pointing to an item in a QLinkedList remain valid as
- long as the item exists, whereas iterators to a QVector can become
- invalid after any insertion or removal.)
-
\row \li \l{QVector}<T>
\li This is by far the most commonly used container class. It
stores a list of values of a given type (T) that can be accessed
@@ -155,7 +147,7 @@
QString and the value type QVector<int>.
The containers are defined in individual header files with the
- same name as the container (e.g., \c <QLinkedList>). For
+ same name as the container (e.g., \c <QVector>). For
convenience, the containers are forward declared in \c
<QtContainerFwd>.
@@ -248,8 +240,6 @@
\header \li Containers \li Read-only iterator
\li Read-write iterator
\li QMutableListIterator<T>
- \row \li QLinkedList<T> \li QLinkedListIterator<T>
- \li QMutableLinkedListIterator<T>
\row \li QVector<T>, QStack<T>, QQueue<T> \li QVectorIterator<T>
\li QMutableVectorIterator<T>
\row \li QSet<T> \li QSetIterator<T>
@@ -261,7 +251,7 @@
\endtable
In this discussion, we will concentrate on QVector and QMap. The
- iterator types for QLinkedList, QVector, and QSet have exactly
+ iterator types for QSet have exactly
the same interface as QVector's iterators; similarly, the iterator
types for QHash have the same interface as QMap's iterators.
@@ -362,7 +352,7 @@
\snippet code/doc_src_containers.cpp 6
- As mentioned above, QLinkedList's, QVector's, and QSet's iterator
+ As mentioned above QSet's iterator
classes have exactly the same API as QVector's. We will now turn to
QMapIterator, which is somewhat different because it iterates on
(key, value) pairs.
@@ -415,8 +405,6 @@
\table
\header \li Containers \li Read-only iterator
\li Read-write iterator
- \row \li QLinkedList<T> \li QLinkedList<T>::const_iterator
- \li QLinkedList<T>::iterator
\row \li QVector<T>, QStack<T>, QQueue<T> \li QVector<T>::const_iterator
\li QVector<T>::iterator
\row \li QSet<T> \li QSet<T>::const_iterator
@@ -437,7 +425,7 @@
just a typedef for \c{const T *}.
In this discussion, we will concentrate on QVector and QMap. The
- iterator types for QLinkedList, QVector, and QSet have exactly
+ iterator types for QSet have exactly
the same interface as QVector's iterators; similarly, the iterator
types for QHash have the same interface as QMap's iterators.
@@ -542,7 +530,7 @@
Its syntax is: \c foreach (\e variable, \e container) \e
statement. For example, here's how to use \c foreach to iterate
- over a QLinkedList<QString>:
+ over a QVector<QString>:
\snippet code/doc_src_containers.cpp 15
@@ -631,9 +619,9 @@
Algorithmic complexity is concerned about how fast (or slow) each
function is as the number of items in the container grow. For
- example, inserting an item in the middle of a QLinkedList is an
+ example, inserting an item in the middle of a std::list is an
extremely fast operation, irrespective of the number of items
- stored in the QLinkedList. On the other hand, inserting an item
+ stored in the list. On the other hand, inserting an item
in the middle of a QVector is potentially very expensive if the
QVector contains many items, since half of the items must be
moved one position in memory.
@@ -651,7 +639,7 @@
\li \b{Constant time:} O(1). A function is said to run in constant
time if it requires the same amount of time no matter how many
items are present in the container. One example is
- QLinkedList::insert().
+ QVector::push_back().
\li \b{Logarithmic time:} O(log \e n). A function that runs in
logarithmic time is a function whose running time is
@@ -673,12 +661,11 @@
number of items stored in the container.
\endlist
- The following table summarizes the algorithmic complexity of Qt's
- sequential container classes:
+ The following table summarizes the algorithmic complexity of the sequential
+ container QVector<T>:
\table
\header \li \li Index lookup \li Insertion \li Prepending \li Appending
- \row \li QLinkedList<T> \li O(\e n) \li O(1) \li O(1) \li O(1)
\row \li QVector<T> \li O(1) \li O(n) \li O(n) \li Amort. O(1)
\endtable
diff --git a/src/corelib/doc/src/datastreamformat.qdoc b/src/corelib/doc/src/datastreamformat.qdoc
index def9021350..b813612eec 100644
--- a/src/corelib/doc/src/datastreamformat.qdoc
+++ b/src/corelib/doc/src/datastreamformat.qdoc
@@ -66,7 +66,6 @@
\li QIcon
\li QImage
\li QKeySequence
- \li QLinkedList<T>
\li QMap<Key, T>
\li QMargins
\li QMatrix4x4
diff --git a/src/corelib/doc/src/dontdocument.qdoc b/src/corelib/doc/src/dontdocument.qdoc
index 5fe05997cc..b1af82fbe2 100644
--- a/src/corelib/doc/src/dontdocument.qdoc
+++ b/src/corelib/doc/src/dontdocument.qdoc
@@ -36,6 +36,6 @@
QContiguousCacheData QContiguousCacheTypedData QNoDebug QUrlTwoFlags
QCborValueRef qfloat16 QDeferredDeleteEvent QSpecialInteger QLittleEndianStorageType
QBigEndianStorageType QFactoryInterface QFutureWatcherBase QJsonValuePtr
- QJsonValueRefPtr QLinkedListNode QAbstractConcatenable QStringBuilderCommon
+ QJsonValueRefPtr QAbstractConcatenable QStringBuilderCommon
QTextCodec::ConverterState QThreadStorageData QTextStreamManipulator)
*/
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index e498772e32..4fcf39f321 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -155,7 +155,7 @@ struct DefinedTypesFilter {
\list
\li Pointers to classes derived from QObject
- \li QList<T>, QVector<T>, QQueue<T>, QStack<T>, QSet<T> or QLinkedList<T>
+ \li QList<T>, QVector<T>, QQueue<T>, QStack<T> or QSet<T>
where T is a registered meta type
\li QHash<T1, T2>, QMap<T1, T2> or QPair<T1, T2> where T1 and T2 are
registered meta types
diff --git a/src/corelib/serialization/qcborstreamwriter.cpp b/src/corelib/serialization/qcborstreamwriter.cpp
index 9d78785416..c73c17aed1 100644
--- a/src/corelib/serialization/qcborstreamwriter.cpp
+++ b/src/corelib/serialization/qcborstreamwriter.cpp
@@ -729,7 +729,7 @@ void QCborStreamWriter::appendTextString(const char *utf8, qsizetype len)
length is implied by the elements contained in it. Note, however, that use
of indeterminate-length arrays is not compliant with canonical CBOR encoding.
- The following example appends elements from the linked list of strings
+ The following example appends elements from the vector of strings
passed as input:
\snippet code/src_corelib_serialization_qcborstream.cpp 20
@@ -802,7 +802,7 @@ bool QCborStreamWriter::endArray()
indeterminate-length maps is not compliant with canonical CBOR encoding
(canonical encoding also requires keys to be unique and in sorted order).
- The following example appends elements from the linked list of int and
+ The following example appends elements from the vector of int and
string pairs passed as input:
\snippet code/src_corelib_serialization_qcborstream.cpp 22
diff --git a/src/corelib/serialization/qdatastream.cpp b/src/corelib/serialization/qdatastream.cpp
index 5082a8cb0d..df286085bc 100644
--- a/src/corelib/serialization/qdatastream.cpp
+++ b/src/corelib/serialization/qdatastream.cpp
@@ -163,7 +163,7 @@ QT_BEGIN_NAMESPACE
\section1 Reading and Writing Qt Collection Classes
The Qt container classes can also be serialized to a QDataStream.
- These include QList, QLinkedList, QVector, QSet, QHash, and QMap.
+ These include QList, QVector, QSet, QHash, and QMap.
The stream operators are declared as non-members of the classes.
\target Serializing Qt Classes
diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc
index c86e69f9c3..a4a30cc798 100644
--- a/src/corelib/tools/qalgorithms.qdoc
+++ b/src/corelib/tools/qalgorithms.qdoc
@@ -39,7 +39,7 @@
on all items in a given container or in a given range.
You can use these algorithms with any \l {container
class} that provides STL-style iterators, including Qt's QList,
- QLinkedList, QVector, QMap, and QHash classes.
+ QVector, QMap, and QHash classes.
Most algorithms take \l {STL-style iterators} as parameters. The
algorithms are generic in the sense that they aren't bound to a
diff --git a/src/corelib/tools/qcontainerfwd.h b/src/corelib/tools/qcontainerfwd.h
index d6e30d77e3..0ace4473ec 100644
--- a/src/corelib/tools/qcontainerfwd.h
+++ b/src/corelib/tools/qcontainerfwd.h
@@ -47,9 +47,6 @@ QT_BEGIN_NAMESPACE
template <class Key, class T> class QCache;
template <class Key, class T> class QHash;
-#if !defined(QT_NO_LINKED_LIST) && QT_DEPRECATED_SINCE(5, 15)
-template <class T> class QLinkedList;
-#endif
template <class Key, class T> class QMap;
template <class Key, class T> class QMultiHash;
template <class Key, class T> class QMultiMap;
diff --git a/src/corelib/tools/qiterator.qdoc b/src/corelib/tools/qiterator.qdoc
index 3531fb202c..69f9d52ce5 100644
--- a/src/corelib/tools/qiterator.qdoc
+++ b/src/corelib/tools/qiterator.qdoc
@@ -201,55 +201,6 @@
*/
/*!
- \class QLinkedListIterator
- \inmodule QtCore
- \obsolete
-
- \brief The QLinkedListIterator class provides a Java-style const iterator for QLinkedList.
-
- QLinkedList has both \l{Java-style iterators} and
- \l{STL-style iterators}. The Java-style iterators are more
- high-level and easier to use than the STL-style iterators; on the
- other hand, they are slightly less efficient.
-
- QLinkedListIterator\<T\> allows you to iterate over a
- QLinkedList\<T\>. If you want to modify the list as you iterate
- over it, use QMutableLinkedListIterator\<T\> instead.
-
- The QLinkedListIterator constructor takes a QLinkedList as
- argument. After construction, the iterator is located at the very
- beginning of the list (before the first item). Here's how to
- iterate over all the elements sequentially:
-
- \snippet code/doc_src_qiterator.cpp 2
-
- The next() function returns the next item in the list and
- advances the iterator. Unlike STL-style iterators, Java-style
- iterators point \e between items rather than directly \e at
- items. The first call to next() advances the iterator to the
- position between the first and second item, and returns the first
- item; the second call to next() advances the iterator to the
- position between the second and third item, and returns the second
- item; and so on.
-
- \image javaiterators1.png
-
- Here's how to iterate over the elements in reverse order:
-
- \snippet code/doc_src_qiterator.cpp 3
-
- If you want to find all occurrences of a particular value, use
- findNext() or findPrevious() in a loop.
-
- Multiple iterators can be used on the same list. If the list is
- modified while a QLinkedListIterator is active, the
- QLinkedListIterator will continue iterating over the original
- list, ignoring the modified copy.
-
- \sa QMutableLinkedListIterator, QLinkedList::const_iterator
-*/
-
-/*!
\class QVectorIterator
\inmodule QtCore
\brief The QVectorIterator class provides a Java-style const iterator for QVector and QStack.
@@ -415,68 +366,6 @@
*/
/*!
- \class QMutableLinkedListIterator
- \inmodule QtCore
- \obsolete
-
- \brief The QMutableLinkedListIterator class provides a Java-style non-const iterator for QLinkedList.
-
- QLinkedList has both \l{Java-style iterators} and
- \l{STL-style iterators}. The Java-style iterators are more
- high-level and easier to use than the STL-style iterators; on the
- other hand, they are slightly less efficient.
-
- QMutableLinkedListIterator\<T\> allows you to iterate over a
- QLinkedList\<T\> and modify the list. If you don't want to modify
- the list (or have a const QLinkedList), use the slightly faster
- QLinkedListIterator\<T\> instead.
-
- The QMutableLinkedListIterator constructor takes a QLinkedList as
- argument. After construction, the iterator is located at the very
- beginning of the list (before the first item). Here's how to
- iterate over all the elements sequentially:
-
- \snippet code/doc_src_qiterator.cpp 11
-
- The next() function returns the next item in the list and
- advances the iterator. Unlike STL-style iterators, Java-style
- iterators point \e between items rather than directly \e at
- items. The first call to next() advances the iterator to the
- position between the first and second item, and returns the first
- item; the second call to next() advances the iterator to the
- position between the second and third item, returning the second
- item; and so on.
-
- \image javaiterators1.png
-
- Here's how to iterate over the elements in reverse order:
-
- \snippet code/doc_src_qiterator.cpp 12
-
- If you want to find all occurrences of a particular value, use
- findNext() or findPrevious() in a loop.
-
- If you want to remove items as you iterate over the list, use
- remove(). If you want to modify the value of an item, use
- setValue(). If you want to insert a new item in the list, use
- insert().
-
- Example:
- \snippet code/doc_src_qiterator.cpp 13
-
- The example traverses a list, replacing negative numbers with
- their absolute values, and eliminating zeroes.
-
- Only one mutable iterator can be active on a given list at any
- time. Furthermore, no changes should be done directly to the list
- while the iterator is active (as opposed to through the
- iterator), since this could invalidate the iterator and lead to
- undefined behavior.
-
- \sa QLinkedListIterator, QLinkedList::iterator
-*/
-
-/*!
\class QMutableVectorIterator
\inmodule QtCore
@@ -595,9 +484,7 @@
/*!
\fn template <class T> QListIterator<T>::QListIterator(const QList<T> &list)
- \fn template <class T> QLinkedListIterator<T>::QLinkedListIterator(const QLinkedList<T> &list)
\fn template <class T> QMutableListIterator<T>::QMutableListIterator(QList<T> &list)
- \fn template <class T> QMutableLinkedListIterator<T>::QMutableLinkedListIterator(QLinkedList<T> &list)
Constructs an iterator for traversing \a list. The iterator is
set to be at the front of the list (before the first item).
@@ -626,9 +513,7 @@
*/
/*! \fn template <class T> QMutableListIterator &QMutableListIterator<T>::operator=(QList<T> &list)
- \fn template <class T> QMutableLinkedListIterator &QMutableLinkedListIterator<T>::operator=(QLinkedList<T> &list)
\fn template <class T> QListIterator &QListIterator<T>::operator=(const QList<T> &list)
- \fn template <class T> QLinkedListIterator &QLinkedListIterator<T>::operator=(const QLinkedList<T> &list)
Makes the iterator operate on \a list. The iterator is set to be
at the front of the list (before the first item).
@@ -655,11 +540,9 @@
*/
/*! \fn template <class T> void QListIterator<T>::toFront()
- \fn template <class T> void QLinkedListIterator<T>::toFront()
\fn template <class T> void QVectorIterator<T>::toFront()
\fn template <class T> void QSetIterator<T>::toFront()
\fn template <class T> void QMutableListIterator<T>::toFront()
- \fn template <class T> void QMutableLinkedListIterator<T>::toFront()
\fn template <class T> void QMutableVectorIterator<T>::toFront()
\fn template <class T> void QMutableSetIterator<T>::toFront()
@@ -670,11 +553,9 @@
*/
/*! \fn template <class T> void QListIterator<T>::toBack()
- \fn template <class T> void QLinkedListIterator<T>::toBack()
\fn template <class T> void QVectorIterator<T>::toBack()
\fn template <class T> void QSetIterator<T>::toBack()
\fn template <class T> void QMutableListIterator<T>::toBack()
- \fn template <class T> void QMutableLinkedListIterator<T>::toBack()
\fn template <class T> void QMutableVectorIterator<T>::toBack()
\fn template <class T> void QMutableSetIterator<T>::toBack()
@@ -685,11 +566,9 @@
*/
/*! \fn template <class T> bool QListIterator<T>::hasNext() const
- \fn template <class T> bool QLinkedListIterator<T>::hasNext() const
\fn template <class T> bool QVectorIterator<T>::hasNext() const
\fn template <class T> bool QSetIterator<T>::hasNext() const
\fn template <class T> bool QMutableListIterator<T>::hasNext() const
- \fn template <class T> bool QMutableLinkedListIterator<T>::hasNext() const
\fn template <class T> bool QMutableVectorIterator<T>::hasNext() const
\fn template <class T> bool QMutableSetIterator<T>::hasNext() const
@@ -701,7 +580,6 @@
*/
/*! \fn template <class T> const T &QListIterator<T>::next()
- \fn template <class T> const T &QLinkedListIterator<T>::next()
\fn template <class T> const T &QVectorIterator<T>::next()
\fn template <class T> const T &QSetIterator<T>::next()
\fn template <class T> const T &QMutableSetIterator<T>::next()
@@ -715,7 +593,6 @@
*/
/*! \fn template <class T> T &QMutableListIterator<T>::next()
- \fn template <class T> T &QMutableLinkedListIterator<T>::next()
\fn template <class T> T &QMutableVectorIterator<T>::next()
Returns a reference to the next item, and advances the iterator
@@ -728,7 +605,6 @@
*/
/*! \fn template <class T> const T &QListIterator<T>::peekNext() const
- \fn template <class T> const T &QLinkedListIterator<T>::peekNext() const
\fn template <class T> const T &QVectorIterator<T>::peekNext() const
\fn template <class T> const T &QSetIterator<T>::peekNext() const
\fn template <class T> const T &QMutableSetIterator<T>::peekNext() const
@@ -742,7 +618,6 @@
*/
/*! \fn template <class T> T &QMutableListIterator<T>::peekNext() const
- \fn template <class T> T &QMutableLinkedListIterator<T>::peekNext() const
\fn template <class T> T &QMutableVectorIterator<T>::peekNext() const
Returns a reference to the next item, without moving the iterator.
@@ -754,11 +629,9 @@
*/
/*! \fn template <class T> bool QListIterator<T>::hasPrevious() const
- \fn template <class T> bool QLinkedListIterator<T>::hasPrevious() const
\fn template <class T> bool QVectorIterator<T>::hasPrevious() const
\fn template <class T> bool QSetIterator<T>::hasPrevious() const
\fn template <class T> bool QMutableListIterator<T>::hasPrevious() const
- \fn template <class T> bool QMutableLinkedListIterator<T>::hasPrevious() const
\fn template <class T> bool QMutableVectorIterator<T>::hasPrevious() const
\fn template <class T> bool QMutableSetIterator<T>::hasPrevious() const
@@ -770,7 +643,6 @@
*/
/*! \fn template <class T> const T &QListIterator<T>::previous()
- \fn template <class T> const T &QLinkedListIterator<T>::previous()
\fn template <class T> const T &QVectorIterator<T>::previous()
\fn template <class T> const T &QSetIterator<T>::previous()
\fn template <class T> const T &QMutableSetIterator<T>::previous()
@@ -785,7 +657,6 @@
*/
/*! \fn template <class T> T &QMutableListIterator<T>::previous()
- \fn template <class T> T &QMutableLinkedListIterator<T>::previous()
\fn template <class T> T &QMutableVectorIterator<T>::previous()
Returns a reference to the previous item and moves the iterator
@@ -798,7 +669,6 @@
*/
/*! \fn template <class T> const T &QListIterator<T>::peekPrevious() const
- \fn template <class T> const T &QLinkedListIterator<T>::peekPrevious() const
\fn template <class T> const T &QVectorIterator<T>::peekPrevious() const
\fn template <class T> const T &QSetIterator<T>::peekPrevious() const
\fn template <class T> const T &QMutableSetIterator<T>::peekPrevious() const
@@ -812,7 +682,6 @@
*/
/*! \fn template <class T> T &QMutableListIterator<T>::peekPrevious() const
- \fn template <class T> T &QMutableLinkedListIterator<T>::peekPrevious() const
\fn template <class T> T &QMutableVectorIterator<T>::peekPrevious() const
Returns a reference to the previous item, without moving the iterator.
@@ -824,11 +693,9 @@
*/
/*! \fn template <class T> bool QListIterator<T>::findNext(const T &value)
- \fn template <class T> bool QLinkedListIterator<T>::findNext(const T &value)
\fn template <class T> bool QVectorIterator<T>::findNext(const T &value)
\fn template <class T> bool QSetIterator<T>::findNext(const T &value)
\fn template <class T> bool QMutableListIterator<T>::findNext(const T &value)
- \fn template <class T> bool QMutableLinkedListIterator<T>::findNext(const T &value)
\fn template <class T> bool QMutableVectorIterator<T>::findNext(const T &value)
\fn template <class T> bool QMutableSetIterator<T>::findNext(const T &value)
@@ -843,11 +710,9 @@
*/
/*! \fn template <class T> bool QListIterator<T>::findPrevious(const T &value)
- \fn template <class T> bool QLinkedListIterator<T>::findPrevious(const T &value)
\fn template <class T> bool QVectorIterator<T>::findPrevious(const T &value)
\fn template <class T> bool QSetIterator<T>::findPrevious(const T &value)
\fn template <class T> bool QMutableListIterator<T>::findPrevious(const T &value)
- \fn template <class T> bool QMutableLinkedListIterator<T>::findPrevious(const T &value)
\fn template <class T> bool QMutableVectorIterator<T>::findPrevious(const T &value)
\fn template <class T> bool QMutableSetIterator<T>::findPrevious(const T &value)
@@ -873,17 +738,6 @@
\sa insert(), setValue()
*/
-/*! \fn template <class T> void QMutableLinkedListIterator<T>::remove()
-
- Removes the last item that was jumped over using one of the
- traversal functions (next(), previous(), findNext(), findPrevious()).
-
- Example:
- \snippet code/doc_src_qiterator.cpp 20
-
- \sa insert(), setValue()
-*/
-
/*! \fn template <class T> void QMutableVectorIterator<T>::remove()
Removes the last item that was jumped over using one of the
@@ -920,20 +774,6 @@
\sa value(), remove(), insert()
*/
-/*! \fn template <class T> void QMutableLinkedListIterator<T>::setValue(const T &value) const
-
- Replaces the value of the last item that was jumped over using
- one of the traversal functions with \a value.
-
- The traversal functions are next(), previous(), findNext(), and
- findPrevious().
-
- Example:
- \snippet code/doc_src_qiterator.cpp 24
-
- \sa value(), remove(), insert()
-*/
-
/*! \fn template <class T> void QMutableVectorIterator<T>::setValue(const T &value) const
Replaces the value of the last item that was jumped over using
@@ -949,7 +789,6 @@
*/
/*! \fn template <class T> const T &QMutableListIterator<T>::value() const
- \fn template <class T> const T &QMutableLinkedListIterator<T>::value() const
\fn template <class T> const T &QMutableVectorIterator<T>::value() const
\fn template <class T> const T &QMutableSetIterator<T>::value() const
@@ -964,7 +803,6 @@
/*!
\fn template <class T> T &QMutableListIterator<T>::value()
- \fn template <class T> T &QMutableLinkedListIterator<T>::value()
\fn template <class T> T &QMutableVectorIterator<T>::value()
\overload
@@ -973,7 +811,6 @@
*/
/*! \fn template <class T> void QMutableListIterator<T>::insert(const T &value)
- \fn template <class T> void QMutableLinkedListIterator<T>::insert(const T &value)
\fn template <class T> void QMutableVectorIterator<T>::insert(const T &value)
Inserts \a value at the current iterator position. After the
diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp
deleted file mode 100644
index 6a423545da..0000000000
--- a/src/corelib/tools/qlinkedlist.cpp
+++ /dev/null
@@ -1,1238 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifdef QT_NO_LINKED_LIST
-# undef QT_NO_LINKED_LIST
-#endif
-
-#include "qlinkedlist.h"
-
-QT_BEGIN_NAMESPACE
-
-#if QT_DEPRECATED_SINCE(5, 15)
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
-
-const QLinkedListData QLinkedListData::shared_null = {
- const_cast<QLinkedListData *>(&QLinkedListData::shared_null),
- const_cast<QLinkedListData *>(&QLinkedListData::shared_null),
- Q_REFCOUNT_INITIALIZE_STATIC, 0, true
-};
-
-/*! \class QLinkedList
- \inmodule QtCore
- \obsolete
- \brief The QLinkedList class is a template class that provides linked lists.
-
- \ingroup tools
- \ingroup shared
-
- \reentrant
-
- \note This class is obsolete, please use std::list instead.
-
- QLinkedList\<T\> is one of Qt's generic \l{container classes}. It
- stores a list of values and provides iterator-based access as
- well as \l{constant time} insertions and removals.
-
- QList\<T\>, QLinkedList\<T\>, and QVector\<T\> provide similar
- functionality. Here's an overview:
-
- \list
- \li For most purposes, QList is the right class to use. Its
- index-based API is more convenient than QLinkedList's
- iterator-based API, and it is usually faster than
- QVector because of the way it stores its items in
- memory (see \l{Algorithmic Complexity} for details).
- It also expands to less code in your executable.
- \li If you need a real linked list, with guarantees of \l{constant
- time} insertions in the middle of the list and iterators to
- items rather than indexes, use QLinkedList.
- \li If you want the items to occupy adjacent memory positions,
- use QVector.
- \endlist
-
- Here's an example of a QLinkedList that stores integers and a
- QLinkedList that stores QTime values:
-
- \snippet code/src_corelib_tools_qlinkedlist.cpp 0
-
- QLinkedList stores a list of items. The default constructor
- creates an empty list. To insert items into the list, you can use
- operator<<():
-
- \snippet code/src_corelib_tools_qlinkedlist.cpp 1
-
- If you want to get the first or last item in a linked list, use
- first() or last(). If you want to remove an item from either end
- of the list, use removeFirst() or removeLast(). If you want to
- remove all occurrences of a given value in the list, use
- removeAll().
-
- A common requirement is to remove the first or last item in the
- list and do something with it. For this, QLinkedList provides
- takeFirst() and takeLast(). Here's a loop that removes the items
- from a list one at a time and calls \c delete on them:
- \snippet code/src_corelib_tools_qlinkedlist.cpp 2
-
- QLinkedList's value type must be an \l {assignable data type}. This
- covers most data types that are commonly used, but the compiler
- won't let you, for example, store a QWidget as a value; instead,
- store a QWidget *. A few functions have additional requirements;
- for example, contains() and removeAll() expect the value type to
- support \c operator==(). These requirements are documented on a
- per-function basis.
-
- If you want to insert, modify, or remove items in the middle of
- the list, you must use an iterator. QLinkedList provides both
- \l{Java-style iterators} (QLinkedListIterator and
- QMutableLinkedListIterator) and \l{STL-style iterators}
- (QLinkedList::const_iterator and QLinkedList::iterator). See the
- documentation for these classes for details.
-
- \sa QLinkedListIterator, QMutableLinkedListIterator, QList, QVector
-*/
-
-/*! \fn template <class T> QLinkedList<T>::QLinkedList()
-
- Constructs an empty list.
-*/
-
-/*!
- \fn template <class T> QLinkedList<T>::QLinkedList(QLinkedList<T> &&other)
-
- Move-constructs a QLinkedList instance, making it point at the same
- object that \a other was pointing to.
-
- \since 5.2
-*/
-
-/*! \fn template <class T> QLinkedList<T>::QLinkedList(const QLinkedList<T> &other)
-
- Constructs a copy of \a other.
-
- This operation occurs in \l{constant time}, because QLinkedList
- is \l{implicitly shared}. This makes returning a QLinkedList from
- a function very fast. If a shared instance is modified, it will
- be copied (copy-on-write), and this takes \l{linear time}.
-
- \sa operator=()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::QLinkedList(std::initializer_list<T> list)
- \since 5.2
-
- Constructs a list from the std::initializer_list specified by \a list.
-
- This constructor is only enabled if the compiler supports C++11
- initializer lists.
-*/
-
-/*! \fn template <class T> template<typename InputIterator> QLinkedList<T>::QLinkedList(InputIterator first, InputIterator last)
- \since 5.14
-
- Constructs a list with the contents in the iterator range [\a first, \a last).
-
- The value type of \c InputIterator must be convertible to \c T.
-*/
-
-/*! \fn template <class T> QLinkedList<T>::~QLinkedList()
-
- Destroys the list. References to the values in the list, and all
- iterators over this list, become invalid.
-*/
-
-/*! \fn template <class T> QLinkedList<T> &QLinkedList<T>::operator=(const QLinkedList<T> &other)
-
- Assigns \a other to this list and returns a reference to this
- list.
-*/
-
-/*! \fn template <class T> void QLinkedList<T>::swap(QLinkedList<T> &other)
- \since 4.8
-
- Swaps list \a other with this list. This operation is very
- fast and never fails.
-*/
-
-/*! \fn template <class T> bool QLinkedList<T>::operator==(const QLinkedList<T> &other) const
-
- Returns \c true if \a other is equal to this list; otherwise returns
- false.
-
- Two lists are considered equal if they contain the same values in
- the same order.
-
- This function requires the value type to implement \c
- operator==().
-
- \sa operator!=()
-*/
-
-/*! \fn template <class T> bool QLinkedList<T>::operator!=(const QLinkedList<T> &other) const
-
- Returns \c true if \a other is not equal to this list; otherwise
- returns \c false.
-
- Two lists are considered equal if they contain the same values in
- the same order.
-
- This function requires the value type to implement \c
- operator==().
-
- \sa operator==()
-*/
-
-/*! \fn template <class T> int QLinkedList<T>::size() const
-
- Returns the number of items in the list.
-
- \sa isEmpty(), count()
-*/
-
-/*! \fn template <class T> void QLinkedList<T>::detach()
-
- \internal
-*/
-
-/*! \fn template <class T> bool QLinkedList<T>::isDetached() const
-
- \internal
-*/
-
-/*! \fn template <class T> void QLinkedList<T>::setSharable(bool sharable)
-
- \internal
-*/
-
-/*! \fn template <class T> bool QLinkedList<T>::isSharedWith(const QLinkedList<T> &other) const
-
- \internal
-*/
-
-/*! \fn template <class T> bool QLinkedList<T>::isEmpty() const
-
- Returns \c true if the list contains no items; otherwise returns
- false.
-
- \sa size()
-*/
-
-/*! \fn template <class T> void QLinkedList<T>::clear()
-
- Removes all the items in the list.
-
- \sa removeAll()
-*/
-
-/*! \fn template <class T> void QLinkedList<T>::append(const T &value)
-
- Inserts \a value at the end of the list.
-
- Example:
- \snippet code/src_corelib_tools_qlinkedlist.cpp 3
-
- This is the same as list.insert(end(), \a value).
-
- \sa operator<<(), prepend(), insert()
-*/
-
-/*! \fn template <class T> void QLinkedList<T>::prepend(const T &value)
-
- Inserts \a value at the beginning of the list.
-
- Example:
- \snippet code/src_corelib_tools_qlinkedlist.cpp 4
-
- This is the same as list.insert(begin(), \a value).
-
- \sa append(), insert()
-*/
-
-/*! \fn template <class T> int QLinkedList<T>::removeAll(const T &value)
-
- Removes all occurrences of \a value in the list.
-
- Example:
- \snippet code/src_corelib_tools_qlinkedlist.cpp 5
-
- This function requires the value type to have an implementation of
- \c operator==().
-
- \sa insert()
-*/
-
-/*!
- \fn template <class T> bool QLinkedList<T>::removeOne(const T &value)
- \since 4.4
-
- Removes the first occurrences of \a value in the list. Returns \c true on
- success; otherwise returns \c false.
-
- Example:
- \snippet code/src_corelib_tools_qlinkedlist.cpp 6
-
- This function requires the value type to have an implementation of
- \c operator==().
-
- \sa insert()
-*/
-
-/*! \fn template <class T> bool QLinkedList<T>::contains(const T &value) const
-
- Returns \c true if the list contains an occurrence of \a value;
- otherwise returns \c false.
-
- This function requires the value type to have an implementation of
- \c operator==().
-
- \sa QLinkedListIterator::findNext(), QLinkedListIterator::findPrevious()
-*/
-
-/*! \fn template <class T> int QLinkedList<T>::count(const T &value) const
-
- Returns the number of occurrences of \a value in the list.
-
- This function requires the value type to have an implementation of
- \c operator==().
-
- \sa contains()
-*/
-
-/*! \fn template <class T> bool QLinkedList<T>::startsWith(const T &value) const
- \since 4.5
-
- Returns \c true if the list is not empty and its first
- item is equal to \a value; otherwise returns \c false.
-
- \sa isEmpty(), first()
-*/
-
-/*! \fn template <class T> bool QLinkedList<T>::endsWith(const T &value) const
- \since 4.5
-
- Returns \c true if the list is not empty and its last
- item is equal to \a value; otherwise returns \c false.
-
- \sa isEmpty(), last()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::begin()
-
- Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in
- the list.
-
- \sa constBegin(), end()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::begin() const
-
- \overload
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::cbegin() const
- \since 5.0
-
- Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
- in the list.
-
- \sa begin(), cend()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::constBegin() const
-
- Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
- in the list.
-
- \sa begin(), constEnd()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::end()
-
- Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item
- after the last item in the list.
-
- \sa begin(), constEnd()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::end() const
-
- \overload
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<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 list.
-
- \sa cbegin(), end()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::constEnd() const
-
- Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
- item after the last item in the list.
-
- \sa constBegin(), end()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::reverse_iterator QLinkedList<T>::rbegin()
- \since 5.6
-
- Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
- item in the list, in reverse order.
-
- \sa begin(), crbegin(), rend()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_reverse_iterator QLinkedList<T>::rbegin() const
- \since 5.6
- \overload
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_reverse_iterator QLinkedList<T>::crbegin() const
- \since 5.6
-
- Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
- item in the list, in reverse order.
-
- \sa begin(), rbegin(), rend()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::reverse_iterator QLinkedList<T>::rend()
- \since 5.6
-
- Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past
- the last item in the list, in reverse order.
-
- \sa end(), crend(), rbegin()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_reverse_iterator QLinkedList<T>::rend() const
- \since 5.6
- \overload
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_reverse_iterator QLinkedList<T>::crend() const
- \since 5.6
-
- Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to one
- past the last item in the list, in reverse order.
-
- \sa end(), rend(), rbegin()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::insert(iterator before, const T &value)
-
- Inserts \a value in front of the item pointed to by the iterator
- \a before. Returns an iterator pointing at the inserted item.
-
- \sa erase()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::erase(iterator pos)
-
- Removes the item pointed to by the iterator \a pos from the list,
- and returns an iterator to the next item in the list (which may be
- end()).
-
- \sa insert()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::erase(iterator begin, iterator end)
-
- \overload
-
- Removes all the items from \a begin up to (but not including) \a
- end.
-*/
-
-/*! \typedef QLinkedList::Iterator
-
- Qt-style synonym for QLinkedList::iterator.
-*/
-
-/*! \typedef QLinkedList::ConstIterator
-
- Qt-style synonym for QLinkedList::const_iterator.
-*/
-
-/*! \typedef QLinkedList::reverse_iterator
- \since 5.6
-
- The QLinkedList::reverse_iterator typedef provides an STL-style non-const
- reverse iterator for QLinkedList.
-
- It is simply a typedef for \c{std::reverse_iterator<QLinkedList::iterator>}.
-
- \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 QLinkedList::rbegin(), QLinkedList::rend(), QLinkedList::const_reverse_iterator, QLinkedList::iterator
-*/
-
-/*! \typedef QLinkedList::const_reverse_iterator
- \since 5.6
-
- The QLinkedList::const_reverse_iterator typedef provides an STL-style const
- reverse iterator for QLinkedList.
-
- It is simply a typedef for \c{std::reverse_iterator<QLinkedList::const_iterator>}.
-
- \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 QLinkedList::rbegin(), QLinkedList::rend(), QLinkedList::reverse_iterator, QLinkedList::const_iterator
-*/
-
-/*!
- \typedef QLinkedList::size_type
-
- Typedef for int. Provided for STL compatibility.
-*/
-
-/*!
- \typedef QLinkedList::value_type
-
- Typedef for T. Provided for STL compatibility.
-*/
-
-/*!
- \typedef QLinkedList::pointer
-
- Typedef for T *. Provided for STL compatibility.
-*/
-
-/*!
- \typedef QLinkedList::const_pointer
-
- Typedef for const T *. Provided for STL compatibility.
-*/
-
-/*!
- \typedef QLinkedList::reference
-
- Typedef for T &. Provided for STL compatibility.
-*/
-
-/*!
- \typedef QLinkedList::const_reference
-
- Typedef for const T &. Provided for STL compatibility.
-*/
-
-/*!
- \typedef QLinkedList::difference_type
-
- Typedef for ptrdiff_t. Provided for STL compatibility.
-*/
-
-/*! \fn template <class T> int QLinkedList<T>::count() const
-
- Same as size().
-*/
-
-/*! \fn template <class T> T& QLinkedList<T>::first()
-
- Returns a reference to the first item in the list. This function
- assumes that the list isn't empty.
-
- \sa last(), isEmpty()
-*/
-
-/*! \fn template <class T> const T& QLinkedList<T>::first() const
-
- \overload
-*/
-
-/*! \fn template <class T> T& QLinkedList<T>::last()
-
- Returns a reference to the last item in the list. This function
- assumes that the list isn't empty.
-
- \sa first(), isEmpty()
-*/
-
-/*! \fn template <class T> const T& QLinkedList<T>::last() const
-
- \overload
-*/
-
-/*! \fn template <class T> void QLinkedList<T>::removeFirst()
-
- Removes the first item in the list.
-
- This is the same as erase(begin()).
-
- \sa removeLast(), erase()
-*/
-
-/*! \fn template <class T> void QLinkedList<T>::removeLast()
-
- Removes the last item in the list.
-
- \sa removeFirst(), erase()
-*/
-
-/*! \fn template <class T> T QLinkedList<T>::takeFirst()
-
- Removes the first item in the list and returns it.
-
- If you don't use the return value, removeFirst() is more
- efficient.
-
- \sa takeLast(), removeFirst()
-*/
-
-/*! \fn template <class T> T QLinkedList<T>::takeLast()
-
- Removes the last item in the list and returns it.
-
- If you don't use the return value, removeLast() is more
- efficient.
-
- \sa takeFirst(), removeLast()
-*/
-
-/*! \fn template <class T> void QLinkedList<T>::push_back(const T &value)
-
- This function is provided for STL compatibility. It is equivalent
- to append(\a value).
-*/
-
-/*! \fn template <class T> void QLinkedList<T>::push_front(const T &value)
-
- This function is provided for STL compatibility. It is equivalent
- to prepend(\a value).
-*/
-
-/*! \fn template <class T> T& QLinkedList<T>::front()
-
- This function is provided for STL compatibility. It is equivalent
- to first().
-*/
-
-/*! \fn template <class T> const T& QLinkedList<T>::front() const
-
- \overload
-*/
-
-/*! \fn template <class T> T& QLinkedList<T>::back()
-
- This function is provided for STL compatibility. It is equivalent
- to last().
-*/
-
-/*! \fn template <class T> const T& QLinkedList<T>::back() const
-
- \overload
-*/
-
-/*! \fn template <class T> void QLinkedList<T>::pop_front()
-
- This function is provided for STL compatibility. It is equivalent
- to removeFirst().
-*/
-
-/*! \fn template <class T> void QLinkedList<T>::pop_back()
-
- This function is provided for STL compatibility. It is equivalent
- to removeLast().
-*/
-
-/*! \fn template <class T> bool QLinkedList<T>::empty() const
-
- This function is provided for STL compatibility. It is equivalent
- to isEmpty() and returns \c true if the list is empty.
-*/
-
-/*! \fn template <class T> QLinkedList<T> &QLinkedList<T>::operator+=(const QLinkedList<T> &other)
-
- Appends the items of the \a other list to this list and returns a
- reference to this list.
-
- \sa operator+(), append()
-*/
-
-/*! \fn template <class T> void QLinkedList<T>::operator+=(const T &value)
-
- \overload
-
- Appends \a value to the list.
-*/
-
-/*! \fn template <class T> QLinkedList<T> QLinkedList<T>::operator+(const QLinkedList<T> &other) const
-
- Returns a list that contains all the items in this list followed
- by all the items in the \a other list.
-
- \sa operator+=()
-*/
-
-/*! \fn template <class T> QLinkedList<T> &QLinkedList<T>::operator<<(const QLinkedList<T> &other)
-
- Appends the items of the \a other list to this list and returns a
- reference to this list.
-
- \sa operator+=(), append()
-*/
-
-/*! \fn template <class T> QLinkedList<T> &QLinkedList<T>::operator<<(const T &value)
-
- \overload
-
- Appends \a value to the list.
-*/
-
-/*! \class QLinkedList::iterator
- \inmodule QtCore
- \obsolete
- \brief The QLinkedList::iterator class provides an STL-style non-const iterator for QLinkedList.
-
- QLinkedList 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.
-
- QLinkedList\<T\>::iterator allows you to iterate over a
- QLinkedList\<T\> and to modify the list item associated with the
- iterator. If you want to iterate over a const QLinkedList, use
- QLinkedList::const_iterator instead. It is generally good
- practice to use QLinkedList::const_iterator on a non-const
- QLinkedList as well, unless you need to change the QLinkedList
- through the iterator. Const iterators are slightly faster, and
- can improve code readability.
-
- The default QLinkedList::iterator constructor creates an
- uninitialized iterator. You must initialize it using a
- function like QLinkedList::begin(), QLinkedList::end(), or
- QLinkedList::insert() before you can start iterating. Here's a
- typical loop that prints all the items stored in a list:
-
- \snippet code/src_corelib_tools_qlinkedlist.cpp 7
-
- STL-style iterators can be used as arguments to \l{generic
- algorithms}. For example, here's how to find an item in the list:
-
- \snippet code/src_corelib_tools_qlinkedlist.cpp 8
-
- Let's see a few examples of things we can do with a
- QLinkedList::iterator that we cannot do with a QLinkedList::const_iterator.
- Here's an example that increments every value stored in a
- QLinkedList\<int\> by 2:
-
- \snippet code/src_corelib_tools_qlinkedlist.cpp 9
-
- Here's an example that removes all the items that start with an
- underscore character in a QLinkedList\<QString\>:
-
- \snippet code/src_corelib_tools_qlinkedlist.cpp 10
-
- The call to QLinkedList::erase() removes the item pointed to by
- the iterator from the list, and returns an iterator to the next
- item. Here's another way of removing an item while iterating:
-
- \snippet code/src_corelib_tools_qlinkedlist.cpp 11
-
- It might be tempting to write code like this:
-
- \snippet code/src_corelib_tools_qlinkedlist.cpp 12
-
- However, this will potentially crash in \c{++i}, because \c i is
- a dangling iterator after the call to erase().
-
- Multiple iterators can be used on the same list. If you add items
- to the list, existing iterators will remain valid. If you remove
- items from the list, iterators that point to the removed items
- will become dangling iterators.
-
- \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 QLinkedList::const_iterator, QMutableLinkedListIterator
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator::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 QLinkedList::begin(), QLinkedList::end()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator::iterator(Node *node)
-
- \internal
-*/
-
-/*! \typedef QLinkedList::iterator::iterator_category
-
- \internal
-*/
-
-/*! \typedef QLinkedList::iterator::difference_type
-
- \internal
-*/
-
-/*! \typedef QLinkedList::iterator::value_type
-
- \internal
-*/
-
-/*! \typedef QLinkedList::iterator::pointer
-
- \internal
-*/
-
-/*! \typedef QLinkedList::iterator::reference
-
- \internal
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator::iterator(const iterator &other)
-
- Constructs a copy of \a other.
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator &QLinkedList<T>::iterator::operator=(const iterator &other)
-
- Assigns \a other to this iterator.
-*/
-
-/*!
- \fn template <class T> QLinkedList<T> &QLinkedList<T>::operator=(QLinkedList<T> &&other)
-
- Move-assigns \a other to this QLinkedList instance.
-
- \since 5.2
-*/
-
-/*! \fn template <class T> T &QLinkedList<T>::iterator::operator*() const
-
- Returns a modifiable reference to the current item.
-
- You can change the value of an item by using operator*() on the
- left side of an assignment, for example:
-
- \snippet code/src_corelib_tools_qlinkedlist.cpp 13
-
- \sa operator->()
-*/
-
-/*! \fn template <class T> T *QLinkedList<T>::iterator::operator->() const
-
- Returns a pointer to the current item.
-
- \sa operator*()
-*/
-
-/*!
- \fn template <class T> bool QLinkedList<T>::iterator::operator==(const iterator &other) const
- \fn template <class T> bool QLinkedList<T>::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 QLinkedList<T>::iterator::operator!=(const iterator &other) const
- \fn template <class T> bool QLinkedList<T>::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> QLinkedList<T>::iterator &QLinkedList<T>::iterator::operator++()
-
- The prefix ++ operator (\c{++it}) advances the iterator to the
- next item in the list and returns an iterator to the new current
- item.
-
- Calling this function on QLinkedList::end() leads to undefined
- results.
-
- \sa operator--()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::iterator::operator++(int)
-
- \overload
-
- The postfix ++ operator (\c{it++}) advances the iterator to the
- next item in the list and returns an iterator to the previously
- current item.
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator &QLinkedList<T>::iterator::operator--()
-
- The prefix -- operator (\c{--it}) makes the preceding item
- current and returns an iterator to the new current item.
-
- Calling this function on QLinkedList::begin() leads to undefined
- results.
-
- \sa operator++()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::iterator::operator--(int)
-
- \overload
-
- The postfix -- operator (\c{it--}) makes the preceding item
- current and returns an iterator to the previously current item.
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::iterator::operator+(int j) const
-
- Returns an iterator to the item at \a j positions forward from
- this iterator. (If \a j is negative, the iterator goes backward.)
-
- This operation can be slow for large \a j values.
-
- \sa operator-()
-
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::iterator::operator-(int j) const
-
- Returns an iterator to the item at \a j positions backward from
- this iterator. (If \a j is negative, the iterator goes forward.)
-
- This operation can be slow for large \a j values.
-
- \sa operator+()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator &QLinkedList<T>::iterator::operator+=(int j)
-
- Advances the iterator by \a j items. (If \a j is negative, the
- iterator goes backward.)
-
- \sa operator-=(), operator+()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::iterator &QLinkedList<T>::iterator::operator-=(int j)
-
- Makes the iterator go back by \a j items. (If \a j is negative,
- the iterator goes forward.)
-
- \sa operator+=(), operator-()
-*/
-
-/*! \class QLinkedList::const_iterator
- \inmodule QtCore
- \obsolete
- \brief The QLinkedList::const_iterator class provides an STL-style const iterator for QLinkedList.
-
- QLinkedList 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.
-
- QLinkedList\<T\>::const_iterator allows you to iterate over a
- QLinkedList\<T\>. If you want modify the QLinkedList as you iterate
- over it, you must use QLinkedList::iterator instead. It is
- generally good practice to use QLinkedList::const_iterator on a
- non-const QLinkedList as well, unless you need to change the
- QLinkedList through the iterator. Const iterators are slightly
- faster, and can improve code readability.
-
- The default QLinkedList::const_iterator constructor creates an
- uninitialized iterator. You must initialize it using a function
- like QLinkedList::constBegin(), QLinkedList::constEnd(), or
- QLinkedList::insert() before you can start iterating. Here's a
- typical loop that prints all the items stored in a list:
-
- \snippet code/src_corelib_tools_qlinkedlist.cpp 14
-
- STL-style iterators can be used as arguments to \l{generic
- algorithms}. For example, here's how to find an item in the list:
-
- \snippet code/src_corelib_tools_qlinkedlist.cpp 15
-
- Multiple iterators can be used on the same list. If you add items
- to the list, existing iterators will remain valid. If you remove
- items from the list, iterators that point to the removed items
- will become dangling iterators.
-
- \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 QLinkedList::iterator, QLinkedListIterator
-*/
-
-/*! \fn template <class T> QLinkedList<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 QLinkedList::constBegin(), QLinkedList::constEnd()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator::const_iterator(Node *node)
-
- \internal
-*/
-
-/*! \typedef QLinkedList::const_iterator::iterator_category
-
- \internal
-*/
-
-/*! \typedef QLinkedList::const_iterator::difference_type
-
- \internal
-*/
-
-/*! \typedef QLinkedList::const_iterator::value_type
-
- \internal
-*/
-
-/*! \typedef QLinkedList::const_iterator::pointer
-
- \internal
-*/
-
-/*! \typedef QLinkedList::const_iterator::reference
-
- \internal
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator::const_iterator(const const_iterator &other)
-
- Constructs a copy of \a other.
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator::const_iterator(iterator other)
-
- Constructs a copy of \a other.
-*/
-
-/*! \fn template <class T> typename QLinkedList<T>::const_iterator &QLinkedList<T>::const_iterator::operator=(const const_iterator &other)
-
- Assigns \a other to this iterator.
-*/
-
-/*! \fn template <class T> const T &QLinkedList<T>::const_iterator::operator*() const
-
- Returns a reference to the current item.
-
- \sa operator->()
-*/
-
-/*! \fn template <class T> const T *QLinkedList<T>::const_iterator::operator->() const
-
- Returns a pointer to the current item.
-
- \sa operator*()
-*/
-
-/*! \fn template <class T> bool QLinkedList<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 QLinkedList<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> QLinkedList<T>::const_iterator &QLinkedList<T>::const_iterator::operator++()
-
- The prefix ++ operator (\c{++it}) advances the iterator to the
- next item in the list and returns an iterator to the new current
- item.
-
- Calling this function on QLinkedList<T>::constEnd() leads to
- undefined results.
-
- \sa operator--()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::const_iterator::operator++(int)
-
- \overload
-
- The postfix ++ operator (\c{it++}) advances the iterator to the
- next item in the list and returns an iterator to the previously
- current item.
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator &QLinkedList<T>::const_iterator::operator--()
-
- The prefix -- operator (\c{--it}) makes the preceding item
- current and returns an iterator to the new current item.
-
- Calling this function on QLinkedList::begin() leads to undefined
- results.
-
- \sa operator++()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::const_iterator::operator--(int)
-
- \overload
-
- The postfix -- operator (\c{it--}) makes the preceding item
- current and returns an iterator to the previously current item.
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::const_iterator::operator+(int j) const
-
- Returns an iterator to the item at \a j positions forward from
- this iterator. (If \a j is negative, the iterator goes backward.)
-
- This operation can be slow for large \a j values.
-
- \sa operator-()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::const_iterator::operator-(int j) const
-
- This function returns an iterator to the item at \a j positions backward from
- this iterator. (If \a j is negative, the iterator goes forward.)
-
- This operation can be slow for large \a j values.
-
- \sa operator+()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator &QLinkedList<T>::const_iterator::operator+=(int j)
-
- Advances the iterator by \a j items. (If \a j is negative, the
- iterator goes backward.)
-
- This operation can be slow for large \a j values.
-
- \sa operator-=(), operator+()
-*/
-
-/*! \fn template <class T> QLinkedList<T>::const_iterator &QLinkedList<T>::const_iterator::operator-=(int j)
-
- Makes the iterator go back by \a j items. (If \a j is negative,
- the iterator goes forward.)
-
- This operation can be slow for large \a j values.
-
- \sa operator+=(), operator-()
-*/
-
-/*! \fn template <class T> QDataStream &operator<<(QDataStream &out, const QLinkedList<T> &list)
- \relates QLinkedList
-
- Writes the linked list \a list 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, QLinkedList<T> &list)
- \relates QLinkedList
-
- Reads a linked list from stream \a in into \a list.
-
- This function requires the value type to implement \c operator>>().
-
- \sa{Serializing Qt Data Types}{Format of the QDataStream operators}
-*/
-
-/*!
- \since 4.1
- \fn template <class T> QLinkedList<T> QLinkedList<T>::fromStdList(const std::list<T> &list)
-
- Returns a QLinkedList object with the data contained in \a list.
- The order of the elements in the QLinkedList is the same as in \a
- list.
-
- Example:
-
- \snippet code/src_corelib_tools_qlinkedlist.cpp 16
-
- \sa toStdList()
-*/
-
-/*!
- \since 4.1
- \fn template <class T> std::list<T> QLinkedList<T>::toStdList() const
-
- Returns a std::list object with the data contained in this
- QLinkedList. Example:
-
- \snippet code/src_corelib_tools_qlinkedlist.cpp 17
-
- \sa fromStdList()
-*/
-
-QT_WARNING_POP
-
-#endif // QT_DEPRECATED_SINCE(5, 15)
-
-QT_END_NAMESPACE
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
deleted file mode 100644
index fd3df74059..0000000000
--- a/src/corelib/tools/qlinkedlist.h
+++ /dev/null
@@ -1,612 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** 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 Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLINKEDLIST_H
-#define QLINKEDLIST_H
-
-#include <QtCore/qglobal.h>
-
-#ifndef QT_NO_LINKED_LIST
-
-#include <QtCore/qiterator.h>
-#include <QtCore/qrefcount.h>
-#include <QtCore/qcontainertools_impl.h>
-#include <QtCore/qdatastream.h>
-#include <QtCore/qtypeinfo.h>
-
-#include <algorithm>
-#include <initializer_list>
-#include <iterator>
-#include <list>
-
-
-#if 0
-// This is needed because of QTBUG-80347
-#pragma qt_class(QLinkedList)
-#pragma qt_class(QLinkedListData)
-#pragma qt_class(QLinkedListNode)
-#endif
-
-#if QT_DEPRECATED_SINCE(5, 15)
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
-
-QT_BEGIN_NAMESPACE
-
-struct QT_DEPRECATED_VERSION_5_15 Q_CORE_EXPORT QLinkedListData
-{
- QLinkedListData *n, *p;
- QtPrivate::RefCount ref;
- int size;
- uint sharable : 1;
-
- static const QLinkedListData shared_null;
-};
-
-template <typename T>
-struct QT_DEPRECATED_VERSION_5_15 QLinkedListNode
-{
- inline QLinkedListNode(const T &arg): t(arg) { }
- QLinkedListNode *n, *p;
- T t;
-};
-
-template <class T>
-class QT_DEPRECATED_VERSION_X_5_15("Use std::list instead") QLinkedList
-{
- typedef QLinkedListNode<T> Node;
- union { QLinkedListData *d; QLinkedListNode<T> *e; };
-
-public:
- inline QLinkedList() noexcept : d(const_cast<QLinkedListData *>(&QLinkedListData::shared_null)) { }
- inline QLinkedList(const QLinkedList<T> &l) : d(l.d) { d->ref.ref(); if (!d->sharable) detach(); }
- inline QLinkedList(std::initializer_list<T> list)
- : QLinkedList(list.begin(), list.end()) {}
- template <typename InputIterator, QtPrivate::IfIsInputIterator<InputIterator> = true>
- inline QLinkedList(InputIterator first, InputIterator last)
- : QLinkedList()
- {
- std::copy(first, last, std::back_inserter(*this));
- }
- ~QLinkedList();
- QLinkedList<T> &operator=(const QLinkedList<T> &);
- QLinkedList(QLinkedList<T> &&other) noexcept
- : d(other.d) { other.d = const_cast<QLinkedListData *>(&QLinkedListData::shared_null); }
- QLinkedList<T> &operator=(QLinkedList<T> &&other) noexcept
- { QLinkedList moved(std::move(other)); swap(moved); return *this; }
- inline void swap(QLinkedList<T> &other) noexcept { qSwap(d, other.d); }
- bool operator==(const QLinkedList<T> &l) const;
- inline bool operator!=(const QLinkedList<T> &l) const { return !(*this == l); }
-
- inline int size() const { return d->size; }
- inline void detach()
- { if (d->ref.isShared()) detach_helper2(this->e); }
- inline bool isDetached() const { return !d->ref.isShared(); }
- inline bool isSharedWith(const QLinkedList<T> &other) const { return d == other.d; }
-
- inline bool isEmpty() const { return d->size == 0; }
-
- void clear();
-
- void append(const T &);
- void prepend(const T &);
- T takeFirst();
- T takeLast();
- int removeAll(const T &t);
- bool removeOne(const T &t);
- bool contains(const T &t) const;
- int count(const T &t) const;
-
- class const_iterator;
-
- class iterator
- {
- public:
- typedef std::bidirectional_iterator_tag iterator_category;
- typedef qptrdiff difference_type;
- typedef T value_type;
- typedef T *pointer;
- typedef T &reference;
- Node *i;
- inline iterator() : i(nullptr) {}
- inline iterator(Node *n) : i(n) {}
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
- iterator(const iterator &other) noexcept : i(other.i) {}
- iterator &operator=(const iterator &other) noexcept { i = other.i; return *this; }
- iterator(iterator &&other) noexcept : i(other.i) {}
- iterator &operator=(iterator &&other) noexcept { return *this = other; }
-#endif
- inline T &operator*() const { return i->t; }
- inline T *operator->() const { return &i->t; }
- inline bool operator==(const iterator &o) const { return i == o.i; }
- inline bool operator!=(const iterator &o) const { return i != o.i; }
- inline bool operator==(const const_iterator &o) const
- { return i == o.i; }
- inline bool operator!=(const const_iterator &o) const
- { return i != o.i; }
- inline iterator &operator++() { i = i->n; return *this; }
- inline iterator operator++(int) { Node *n = i; i = i->n; return n; }
- inline iterator &operator--() { i = i->p; return *this; }
- inline iterator operator--(int) { Node *n = i; i = i->p; return n; }
- inline iterator operator+(int j) const
- { Node *n = i; if (j > 0) while (j--) n = n->n; else while (j++) n = n->p; return n; }
- inline iterator operator-(int j) const { return operator+(-j); }
- inline iterator &operator+=(int j) { return *this = *this + j; }
- inline iterator &operator-=(int j) { return *this = *this - j; }
- friend inline iterator operator+(int j, iterator k) { return k + j; }
- };
- friend class iterator;
-
- class const_iterator
- {
- public:
- typedef std::bidirectional_iterator_tag iterator_category;
- typedef qptrdiff difference_type;
- typedef T value_type;
- typedef const T *pointer;
- typedef const T &reference;
- Node *i;
- inline const_iterator() : i(nullptr) {}
- inline const_iterator(Node *n) : i(n) {}
- inline const_iterator(iterator ci) : i(ci.i){}
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
- const_iterator(const const_iterator &other) noexcept : i(other.i) {}
- const_iterator &operator=(const const_iterator &other) noexcept { i = other.i; return *this; }
- const_iterator(const_iterator &&other) noexcept : i(other.i) {}
- const_iterator &operator=(const_iterator &&other) noexcept { return *this = other; }
-#endif
- inline const T &operator*() const { return i->t; }
- inline const T *operator->() const { return &i->t; }
- inline bool operator==(const const_iterator &o) const { return i == o.i; }
- inline bool operator!=(const const_iterator &o) const { return i != o.i; }
- inline const_iterator &operator++() { i = i->n; return *this; }
- inline const_iterator operator++(int) { Node *n = i; i = i->n; return n; }
- inline const_iterator &operator--() { i = i->p; return *this; }
- inline const_iterator operator--(int) { Node *n = i; i = i->p; return n; }
- inline const_iterator operator+(int j) const
- { Node *n = i; if (j > 0) while (j--) n = n->n; else while (j++) n = n->p; return n; }
- inline const_iterator operator-(int j) const { return operator+(-j); }
- inline const_iterator &operator+=(int j) { return *this = *this + j; }
- inline const_iterator &operator-=(int j) { return *this = *this - j; }
- friend inline const_iterator operator+(int j, const_iterator k) { return k + j; }
- };
- friend class const_iterator;
-
- // stl style
- typedef std::reverse_iterator<iterator> reverse_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-
- inline iterator begin() { detach(); return e->n; }
- inline const_iterator begin() const noexcept { return e->n; }
- inline const_iterator cbegin() const noexcept { return e->n; }
- inline const_iterator constBegin() const noexcept { return e->n; }
- inline iterator end() { detach(); return e; }
- inline const_iterator end() const noexcept { return e; }
- inline const_iterator cend() const noexcept { return e; }
- inline const_iterator constEnd() const noexcept { return e; }
-
- reverse_iterator rbegin() { return reverse_iterator(end()); }
- reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); }
- const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
- const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
- const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); }
-
- iterator insert(iterator before, const T &t);
- iterator erase(iterator pos);
- iterator erase(iterator first, iterator last);
-
- // more Qt
- typedef iterator Iterator;
- typedef const_iterator ConstIterator;
- inline int count() const { return d->size; }
- inline T& first() { Q_ASSERT(!isEmpty()); return *begin(); }
- inline const T& first() const { Q_ASSERT(!isEmpty()); return *begin(); }
- T& last() { Q_ASSERT(!isEmpty()); return *(--end()); }
- const T& last() const { Q_ASSERT(!isEmpty()); return *(--end()); }
- inline void removeFirst() { Q_ASSERT(!isEmpty()); erase(begin()); }
- inline void removeLast() { Q_ASSERT(!isEmpty()); erase(--end()); }
- inline bool startsWith(const T &t) const { return !isEmpty() && first() == t; }
- inline bool endsWith(const T &t) const { return !isEmpty() && last() == t; }
-
- // stl compatibility
- inline void push_back(const T &t) { append(t); }
- inline void push_front(const T &t) { prepend(t); }
- inline T& front() { return first(); }
- inline const T& front() const { return first(); }
- inline T& back() { return last(); }
- inline const T& back() const { return last(); }
- inline void pop_front() { removeFirst(); }
- inline void pop_back() { removeLast(); }
- inline bool empty() const { return isEmpty(); }
- typedef int size_type;
- typedef T value_type;
- typedef value_type *pointer;
- typedef const value_type *const_pointer;
- typedef value_type &reference;
- typedef const value_type &const_reference;
- typedef qptrdiff difference_type;
-
- static inline QLinkedList<T> fromStdList(const std::list<T> &list)
- { QLinkedList<T> tmp; std::copy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; }
- inline std::list<T> toStdList() const
- { std::list<T> tmp; std::copy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
-
- // comfort
- QLinkedList<T> &operator+=(const QLinkedList<T> &l);
- QLinkedList<T> operator+(const QLinkedList<T> &l) const;
- inline QLinkedList<T> &operator+=(const T &t) { append(t); return *this; }
- inline QLinkedList<T> &operator<< (const T &t) { append(t); return *this; }
- inline QLinkedList<T> &operator<<(const QLinkedList<T> &l) { *this += l; return *this; }
-
-private:
- void detach_helper();
- iterator detach_helper2(iterator);
- void freeData(QLinkedListData*);
-};
-template <typename T>
-Q_DECLARE_TYPEINFO_BODY(QLinkedList<T>, Q_MOVABLE_TYPE|Q_RELOCATABLE_TYPE);
-
-#if defined(__cpp_deduction_guides) && __cpp_deduction_guides >= 201606
-template <typename InputIterator,
- typename ValueType = typename std::iterator_traits<InputIterator>::value_type,
- QtPrivate::IfIsInputIterator<InputIterator> = true>
-QLinkedList(InputIterator, InputIterator) -> QLinkedList<ValueType>;
-#endif
-
-template <typename T>
-inline QLinkedList<T>::~QLinkedList()
-{
- if (!d->ref.deref())
- freeData(d);
-}
-
-template <typename T>
-void QLinkedList<T>::detach_helper()
-{
- detach_helper2(this->e);
-}
-
-template <typename T>
-typename QLinkedList<T>::iterator QLinkedList<T>::detach_helper2(iterator orgite)
-{
- // detach and convert orgite to an iterator in the detached instance
- bool isEndIterator = (orgite.i == this->e);
- union { QLinkedListData *d; Node *e; } x;
- x.d = new QLinkedListData;
- x.d->ref.initializeOwned();
- x.d->size = d->size;
- x.d->sharable = true;
- Node *original = e->n;
- Node *copy = x.e;
- Node *org = orgite.i;
-
- while (original != org) {
- QT_TRY {
- copy->n = new Node(original->t);
- copy->n->p = copy;
- original = original->n;
- copy = copy->n;
- } QT_CATCH(...) {
- copy->n = x.e;
- Q_ASSERT(!x.d->ref.deref()); // Don't trigger assert in free
- freeData(x.d);
- QT_RETHROW;
- }
- }
- iterator r(copy);
- while (original != e) {
- QT_TRY {
- copy->n = new Node(original->t);
- copy->n->p = copy;
- original = original->n;
- copy = copy->n;
- } QT_CATCH(...) {
- copy->n = x.e;
- Q_ASSERT(!x.d->ref.deref()); // Don't trigger assert in free
- freeData(x.d);
- QT_RETHROW;
- }
- }
- copy->n = x.e;
- x.e->p = copy;
- if (!d->ref.deref())
- freeData(d);
- d = x.d;
- if (!isEndIterator)
- ++r; // since we stored the element right before the original node.
- return r;
-}
-
-template <typename T>
-void QLinkedList<T>::freeData(QLinkedListData *x)
-{
- Node *y = reinterpret_cast<Node*>(x);
- Node *i = y->n;
- Q_ASSERT(x->ref.atomic.loadRelaxed() == 0);
- while (i != y) {
- Node *n = i;
- i = i->n;
- delete n;
- }
- delete x;
-}
-
-template <typename T>
-void QLinkedList<T>::clear()
-{
- *this = QLinkedList<T>();
-}
-
-template <typename T>
-QLinkedList<T> &QLinkedList<T>::operator=(const QLinkedList<T> &l)
-{
- if (d != l.d) {
- QLinkedListData *o = l.d;
- o->ref.ref();
- if (!d->ref.deref())
- freeData(d);
- d = o;
- if (!d->sharable)
- detach_helper();
- }
- return *this;
-}
-
-template <typename T>
-bool QLinkedList<T>::operator== (const QLinkedList<T> &l) const
-{
- if (d->size != l.d->size)
- return false;
- if (e == l.e)
- return true;
- Node *i = e->n;
- Node *il = l.e->n;
- while (i != e) {
- if (! (i->t == il->t))
- return false;
- i = i->n;
- il = il->n;
- }
- return true;
-}
-
-template <typename T>
-void QLinkedList<T>::append(const T &t)
-{
- detach();
- Node *i = new Node(t);
- i->n = e;
- i->p = e->p;
- i->p->n = i;
- e->p = i;
- d->size++;
-}
-
-template <typename T>
-void QLinkedList<T>::prepend(const T &t)
-{
- detach();
- Node *i = new Node(t);
- i->n = e->n;
- i->p = e;
- i->n->p = i;
- e->n = i;
- d->size++;
-}
-
-template <typename T>
-int QLinkedList<T>::removeAll(const T &_t)
-{
- detach();
- const T t = _t;
- Node *i = e->n;
- int c = 0;
- while (i != e) {
- if (i->t == t) {
- Node *n = i;
- i->n->p = i->p;
- i->p->n = i->n;
- i = i->n;
- delete n;
- c++;
- } else {
- i = i->n;
- }
- }
- d->size-=c;
- return c;
-}
-
-template <typename T>
-bool QLinkedList<T>::removeOne(const T &_t)
-{
- detach();
- iterator it = std::find(begin(), end(), _t);
- if (it != end()) {
- erase(it);
- return true;
- }
- return false;
-}
-
-template <typename T>
-inline T QLinkedList<T>::takeFirst()
-{
- T t = std::move(first());
- removeFirst();
- return t;
-}
-
-template <typename T>
-inline T QLinkedList<T>::takeLast()
-{
- T t = std::move(last());
- removeLast();
- return t;
-}
-
-template <typename T>
-bool QLinkedList<T>::contains(const T &t) const
-{
- Node *i = e;
- while ((i = i->n) != e)
- if (i->t == t)
- return true;
- return false;
-}
-
-template <typename T>
-int QLinkedList<T>::count(const T &t) const
-{
- Node *i = e;
- int c = 0;
- while ((i = i->n) != e)
- if (i->t == t)
- c++;
- return c;
-}
-
-
-template <typename T>
-typename QLinkedList<T>::iterator QLinkedList<T>::insert(iterator before, const T &t)
-{
- if (d->ref.isShared())
- before = detach_helper2(before);
-
- Node *i = before.i;
- Node *m = new Node(t);
- m->n = i;
- m->p = i->p;
- m->p->n = m;
- i->p = m;
- d->size++;
- return m;
-}
-
-template <typename T>
-typename QLinkedList<T>::iterator QLinkedList<T>::erase(typename QLinkedList<T>::iterator afirst,
- typename QLinkedList<T>::iterator alast)
-{
- while (afirst != alast)
- erase(afirst++);
- return alast;
-}
-
-
-template <typename T>
-typename QLinkedList<T>::iterator QLinkedList<T>::erase(iterator pos)
-{
- if (d->ref.isShared())
- pos = detach_helper2(pos);
-
- Node *i = pos.i;
- if (i != e) {
- Node *n = i;
- i->n->p = i->p;
- i->p->n = i->n;
- i = i->n;
- delete n;
- d->size--;
- }
- return i;
-}
-
-template <typename T>
-QLinkedList<T> &QLinkedList<T>::operator+=(const QLinkedList<T> &l)
-{
- detach();
- int n = l.d->size;
- d->size += n;
- Node *original = l.e->n;
- while (n--) {
- QT_TRY {
- Node *copy = new Node(original->t);
- original = original->n;
- copy->n = e;
- copy->p = e->p;
- copy->p->n = copy;
- e->p = copy;
- } QT_CATCH(...) {
- // restore the original list
- while (n++<d->size)
- removeLast();
- QT_RETHROW;
- }
- }
- return *this;
-}
-
-template <typename T>
-QLinkedList<T> QLinkedList<T>::operator+(const QLinkedList<T> &l) const
-{
- QLinkedList<T> n = *this;
- n += l;
- return n;
-}
-
-Q_DECLARE_SEQUENTIAL_ITERATOR(LinkedList)
-Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(LinkedList)
-
-#ifndef QT_NO_DATASTREAM
-template <typename T>
-inline QDataStream &operator>>(QDataStream &s, QLinkedList<T> &l)
-{
- return QtPrivate::readListBasedContainer(s, l);
-}
-
-template <typename T>
-inline QDataStream &operator<<(QDataStream &s, const QLinkedList<T> &l)
-{
- return QtPrivate::writeSequentialContainer(s, l);
-}
-#endif
-
-QT_END_NAMESPACE
-
-Q_DECLARE_SEQUENTIAL_CONTAINER_METATYPE(QLinkedList)
-
-QT_WARNING_POP
-
-#endif // QT_DEPRECATED_SINCE(5, 15)
-
-#endif // QT_NO_LINKED_LIST
-
-#endif // QLINKEDLIST_H
diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc
index e5ba47b8ef..a0e9abe0ae 100644
--- a/src/corelib/tools/qvarlengtharray.qdoc
+++ b/src/corelib/tools/qvarlengtharray.qdoc
@@ -87,7 +87,7 @@
places inside Qt and was added to Qt's public API for the
convenience of advanced users.
- \sa QVector, QList, QLinkedList
+ \sa QVector, QList
*/
/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::QVarLengthArray(int size)
@@ -537,8 +537,7 @@
For large arrays, this operation can be slow (\l{linear time}),
because it requires moving all the items in the vector by one
position further in memory. If you want a container class that
- provides a fast prepend() function, use QList or QLinkedList
- instead.
+ provides a fast prepend() function, use std::list instead.
\sa append(), insert()
*/
@@ -718,7 +717,7 @@
For large arrays, this operation can be slow (\l{linear time}),
because it requires moving all the items at indexes \a i and
above by one position further in memory. If you want a container
- class that provides a fast insert() function, use QLinkedList
+ class that provides a fast insert() function, use std::list
instead.
\sa remove()
diff --git a/src/corelib/tools/qvector.qdoc b/src/corelib/tools/qvector.qdoc
index a5ea4073f8..daa6ff95e9 100644
--- a/src/corelib/tools/qvector.qdoc
+++ b/src/corelib/tools/qvector.qdoc
@@ -39,7 +39,7 @@
stores its items in adjacent memory locations and provides fast
index-based access.
- QList\<T\>, QLinkedList\<T\>, QVector\<T\>, and QVarLengthArray\<T\>
+ QList\<T\>, QVector\<T\>, and QVarLengthArray\<T\>
provide similar APIs and functionality. They are often interchangeable,
but there are performance consequences. Here is an overview of use cases:
@@ -57,18 +57,13 @@
those APIs.
\li If you need a real linked list, which guarantees
\l{Algorithmic Complexity}{constant time} insertions mid-list and
- uses iterators to items rather than indexes, use QLinkedList.
+ uses iterators to items rather than indexes, use std::list.
\endlist
\note QVector and QVarLengthArray both guarantee C-compatible
array layout. QList does not. This might be important if your
application must interface with a C API.
- \note Iterators into a QLinkedList and references into
- heap-allocating QLists remain valid as long as the referenced items
- remain in the container. This is not true for iterators and
- references into a QVector and non-heap-allocating QLists.
-
Here's an example of a QVector that stores integers and a QVector
that stores QString values:
@@ -129,7 +124,7 @@
(\l{linear time}) for large vectors, because they require moving many
items in the vector by one position in memory. If you want a container
class that provides fast insertion/removal in the middle, use
- QList or QLinkedList instead.
+ std::list instead.
Unlike plain C++ arrays, QVectors can be resized at any time by
calling resize(). If the new size is larger than the old size,
@@ -190,8 +185,6 @@
holding a lot of allocated memory, especially large, contiguous blocks.
Such considerations, the configuration of such behavior or any mitigation
are outside the scope of the Qt API.
-
- \sa QVectorIterator, QMutableVectorIterator, QList, QLinkedList
*/
/*!
@@ -640,7 +633,7 @@
For large vectors, this operation can be slow (\l{linear time}),
because it requires moving all the items in the vector by one
position further in memory. If you want a container class that
- provides a fast prepend() function, use QList or QLinkedList
+ provides a fast prepend operation, use std::list
instead.
\sa append(), insert()
@@ -681,7 +674,7 @@
For large vectors, this operation can be slow (\l{linear time}),
because it requires moving all the items at indexes \a i and
above by one position further in memory. If you want a container
- class that provides a fast insert() function, use QLinkedList
+ class that provides a fast insert() function, use std::list
instead.
\sa append(), prepend(), remove()
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index ff300bcf7b..edf4248c44 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -19,7 +19,6 @@ HEADERS += \
tools/qhashfunctions.h \
tools/qiterator.h \
tools/qline.h \
- tools/qlinkedlist.h \
tools/qlist.h \
tools/qmakearray_p.h \
tools/qmap.h \
@@ -56,7 +55,6 @@ SOURCES += \
tools/qfreelist.cpp \
tools/qhash.cpp \
tools/qline.cpp \
- tools/qlinkedlist.cpp \
tools/qlist.cpp \
tools/qpoint.cpp \
tools/qmap.cpp \
diff --git a/src/plugins/platforms/xcb/qxcbeventqueue.cpp b/src/plugins/platforms/xcb/qxcbeventqueue.cpp
index 759ee3cc95..f0cb5edd2a 100644
--- a/src/plugins/platforms/xcb/qxcbeventqueue.cpp
+++ b/src/plugins/platforms/xcb/qxcbeventqueue.cpp
@@ -62,8 +62,8 @@ static bool dispatcherOwnerDestructing = false;
when accessing the tail node. It does not dequeue the last node and does not
access (read or write) the tail node's 'next' member. This lets the reader
add more items at the same time as the main thread is dequeuing nodes from
- the head. A custom linked list implementation is used, because QLinkedList
- does not have any thread-safety guarantees and the custom list is more
+ the head. A custom linked list implementation is used, because std::list
+ does not have any thread-safety guarantees. The custom list is
lightweight - no reference counting, back links, etc.
Memory management:
diff --git a/src/tools/qlalr/lalr.h b/src/tools/qlalr/lalr.h
index 473ea89769..16c957624f 100644
--- a/src/tools/qlalr/lalr.h
+++ b/src/tools/qlalr/lalr.h
@@ -32,7 +32,6 @@
#include <QtCore/qset.h>
#include <QtCore/qstack.h>
#include <QtCore/qmap.h>
-#include <QtCore/qlinkedlist.h>
#include <QtCore/qstring.h>
#include <QtCore/qtextstream.h>
#include <QtCore/qpair.h>
diff --git a/src/tools/uic/qclass_lib_map.h b/src/tools/uic/qclass_lib_map.h
index 841144133f..3187d28396 100644
--- a/src/tools/uic/qclass_lib_map.h
+++ b/src/tools/uic/qclass_lib_map.h
@@ -194,13 +194,6 @@ QT_CLASS_LIB(QHashIterator, QtCore, qhash.h)
QT_CLASS_LIB(QMutableHashIterator, QtCore, qhash.h)
QT_CLASS_LIB(QLine, QtCore, qline.h)
QT_CLASS_LIB(QLineF, QtCore, qline.h)
-QT_CLASS_LIB(QLinkedListData, QtCore, qlinkedlist.h)
-QT_CLASS_LIB(QLinkedListNode, QtCore, qlinkedlist.h)
-QT_CLASS_LIB(QLinkedList, QtCore, qlinkedlist.h)
-QT_CLASS_LIB(QLinkedListIterator, QtCore, qlinkedlist.h)
-QT_CLASS_LIB(QMutableLinkedListIterator, QtCore, qlinkedlist.h)
-QT_CLASS_LIB(QLinkedListIterator, QtCore, qlinkedlist.h)
-QT_CLASS_LIB(QMutableLinkedListIterator, QtCore, qlinkedlist.h)
QT_CLASS_LIB(QListData, QtCore, qlist.h)
QT_CLASS_LIB(QList, QtCore, qlist.h)
QT_CLASS_LIB(QListIterator, QtCore, qlist.h)
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
index af0ee3d38c..c5c24adde3 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -41,7 +41,6 @@
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qapplication.h>
-#include <QtCore/qlinkedlist.h>
#include <QtCore/qstack.h>
#ifdef QT_DEBUG
diff --git a/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro b/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro
index b372923310..f2e3e0c8e1 100644
--- a/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro
+++ b/tests/auto/concurrent/qtconcurrentfilter/qtconcurrentfilter.pro
@@ -2,4 +2,3 @@ CONFIG += testcase
TARGET = tst_qtconcurrentfilter
QT = core testlib concurrent
SOURCES = tst_qtconcurrentfilter.cpp
-DEFINES -= QT_NO_LINKED_LIST
diff --git a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
index 8c4e1c16f3..e6ac829230 100644
--- a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
+++ b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
@@ -28,7 +28,6 @@
#include <qtconcurrentfilter.h>
#include <QCoreApplication>
#include <QList>
-#include <QLinkedList>
#include <QtTest/QtTest>
#include "../qtconcurrentmap/functions.h"
@@ -63,18 +62,6 @@ void tst_QtConcurrentFilter::filter()
QCOMPARE(list, QList<int>() << 2 << 4);
}
{
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QtConcurrent::filter(linkedList, KeepEvenIntegers()).waitForFinished();
- QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QtConcurrent::blockingFilter(linkedList, KeepEvenIntegers());
- QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
- }
- {
QVector<int> vector;
vector << 1 << 2 << 3 << 4;
QtConcurrent::filter(vector, KeepEvenIntegers()).waitForFinished();
@@ -100,18 +87,6 @@ void tst_QtConcurrentFilter::filter()
QtConcurrent::blockingFilter(list, keepEvenIntegers);
QCOMPARE(list, QList<int>() << 2 << 4);
}
- {
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QtConcurrent::filter(linkedList, keepEvenIntegers).waitForFinished();
- QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QtConcurrent::blockingFilter(linkedList, keepEvenIntegers);
- QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
- }
// bound function
{
@@ -126,18 +101,6 @@ void tst_QtConcurrentFilter::filter()
QtConcurrent::blockingFilter(list, keepEvenIntegers);
QCOMPARE(list, QList<int>() << 2 << 4);
}
- {
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QtConcurrent::filter(linkedList, keepEvenIntegers).waitForFinished();
- QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QtConcurrent::blockingFilter(linkedList, keepEvenIntegers);
- QCOMPARE(linkedList, QLinkedList<int>() << 2 << 4);
- }
// member
{
@@ -152,18 +115,6 @@ void tst_QtConcurrentFilter::filter()
QtConcurrent::blockingFilter(list, &Number::isEven);
QCOMPARE(list, QList<Number>() << 2 << 4);
}
- {
- QLinkedList<Number> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QtConcurrent::filter(linkedList, &Number::isEven).waitForFinished();
- QCOMPARE(linkedList, QLinkedList<Number>() << 2 << 4);
- }
- {
- QLinkedList<Number> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QtConcurrent::blockingFilter(linkedList, &Number::isEven);
- QCOMPARE(linkedList, QLinkedList<Number>() << 2 << 4);
- }
}
void tst_QtConcurrentFilter::filtered()
@@ -219,19 +170,6 @@ void tst_QtConcurrentFilter::filtered()
QCOMPARE(f.results(), QList<int>() << 2 << 4);
}
- {
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFiltered(linkedList, KeepEvenIntegers());
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QFuture<int> f = QtConcurrent::filtered(linkedList, KeepEvenIntegers());
- QCOMPARE(f.results(), QList<int>() << 2 << 4);
- }
-
// function
{
QFuture<int> f = QtConcurrent::filtered(list, keepEvenIntegers);
@@ -351,172 +289,6 @@ void tst_QtConcurrentFilter::filtered()
&Number::isEven);
QCOMPARE(list2, QList<Number>() << 2 << 4);
}
-
- // same thing on linked lists
-
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
-
- // functor
- {
- QFuture<int> f = QtConcurrent::filtered(linkedList, KeepEvenIntegers());
- QList<int> linkedList2 = f.results();
- QCOMPARE(linkedList2, QList<int>() << 2 << 4);
- }
- {
- QFuture<int> f = QtConcurrent::filtered(linkedList.begin(),
- linkedList.end(),
- KeepEvenIntegers());
- QList<int> linkedList2 = f.results();
- QCOMPARE(linkedList2, QList<int>() << 2 << 4);
- }
- {
- QFuture<int> f = QtConcurrent::filtered(linkedList.constBegin(),
- linkedList.constEnd(),
- KeepEvenIntegers());
- QList<int> linkedList2 = f.results();
- QCOMPARE(linkedList2, QList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFiltered(linkedList, KeepEvenIntegers());
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFiltered<QLinkedList<int> >(linkedList.begin(),
- linkedList.end(),
- KeepEvenIntegers());
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFiltered<QLinkedList<int> >(linkedList.constBegin(),
- linkedList.constEnd(),
- KeepEvenIntegers());
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
-
- // function
- {
- QFuture<int> f = QtConcurrent::filtered(linkedList, keepEvenIntegers);
- QList<int> linkedList2 = f.results();
- QCOMPARE(linkedList2, QList<int>() << 2 << 4);
- }
- {
- QFuture<int> f = QtConcurrent::filtered(linkedList.begin(),
- linkedList.end(),
- keepEvenIntegers);
- QList<int> linkedList2 = f.results();
- QCOMPARE(linkedList2, QList<int>() << 2 << 4);
- }
- {
- QFuture<int> f = QtConcurrent::filtered(linkedList.constBegin(),
- linkedList.constEnd(),
- keepEvenIntegers);
- QList<int> linkedList2 = f.results();
- QCOMPARE(linkedList2, QList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFiltered(linkedList, keepEvenIntegers);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFiltered<QLinkedList<int> >(linkedList.begin(),
- linkedList.end(),
- keepEvenIntegers);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFiltered<QLinkedList<int> >(linkedList.constBegin(),
- linkedList.constEnd(),
- keepEvenIntegers);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
-
- // bound function
- {
- QFuture<int> f = QtConcurrent::filtered(linkedList, keepEvenIntegers);
- QList<int> linkedList2 = f.results();
- QCOMPARE(linkedList2, QList<int>() << 2 << 4);
- }
- {
- QFuture<int> f = QtConcurrent::filtered(linkedList.begin(),
- linkedList.end(),
- keepEvenIntegers);
- QList<int> linkedList2 = f.results();
- QCOMPARE(linkedList2, QList<int>() << 2 << 4);
- }
- {
- QFuture<int> f = QtConcurrent::filtered(linkedList.constBegin(),
- linkedList.constEnd(),
- keepEvenIntegers);
- QList<int> linkedList2 = f.results();
- QCOMPARE(linkedList2, QList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFiltered(linkedList, keepEvenIntegers);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFiltered<QLinkedList<int> >(linkedList.begin(),
- linkedList.end(),
- keepEvenIntegers);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFiltered<QLinkedList<int> >(linkedList.constBegin(),
- linkedList.constEnd(),
- keepEvenIntegers);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
-
- // const member function
- {
- QLinkedList<Number> integers;
- integers << 1 << 2 << 3 << 4;
- QFuture<Number> f = QtConcurrent::filtered(integers, &Number::isEven);
- QList<Number> linkedList2 = f.results();
- QCOMPARE(linkedList2, QList<Number>() << 2 << 4);
- }
- {
- QLinkedList<Number> integers;
- integers << 1 << 2 << 3 << 4;
- QFuture<Number> f = QtConcurrent::filtered(integers.begin(),
- integers.end(),
- &Number::isEven);
- QList<Number> linkedList2 = f.results();
- QCOMPARE(linkedList2, QList<Number>() << 2 << 4);
- }
- {
- QLinkedList<Number> integers;
- integers << 1 << 2 << 3 << 4;
- QFuture<Number> f = QtConcurrent::filtered(integers.constBegin(),
- integers.constEnd(),
- &Number::isEven);
- QList<Number> linkedList2 = f.results();
- QCOMPARE(linkedList2, QList<Number>() << 2 << 4);
- }
- {
- QLinkedList<Number> integers;
- integers << 1 << 2 << 3 << 4;
- QLinkedList<Number> linkedList2 = QtConcurrent::blockingFiltered(integers, &Number::isEven);
- QCOMPARE(linkedList2, QLinkedList<Number>() << 2 << 4);
- }
- {
- QLinkedList<Number> integers;
- integers << 1 << 2 << 3 << 4;
- QLinkedList<Number> linkedList2 = QtConcurrent::blockingFiltered<QLinkedList<Number> >(integers.begin(),
- integers.end(),
- &Number::isEven);
- QCOMPARE(linkedList2, QLinkedList<Number>() << 2 << 4);
- }
- {
- QLinkedList<Number> integers;
- integers << 1 << 2 << 3 << 4;
- QLinkedList<Number> linkedList2 =
- QtConcurrent::blockingFiltered<QLinkedList<Number> >(integers.constBegin(),
- integers.constEnd(),
- &Number::isEven);
- QCOMPARE(linkedList2, QLinkedList<Number>() << 2 << 4);
- }
}
void tst_QtConcurrentFilter::filteredReduced()
@@ -956,432 +728,6 @@ void tst_QtConcurrentFilter::filteredReduced()
QCOMPARE(sum, 6);
}
- // same as above on linked lists
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3 << 4;
- QLinkedList<Number> numberLinkedList;
- numberLinkedList << 1 << 2 << 3 << 4;
-
- // functor-functor
- {
- int sum = QtConcurrent::filteredReduced<int>(linkedList, KeepEvenIntegers(), IntSumReduce());
- QCOMPARE(sum, 6);
-
- int sum2 = QtConcurrent::filteredReduced<int>(linkedList, keepEvenIntegers, intSumReduce);
- QCOMPARE(sum2, 6);
- }
- {
- int sum = QtConcurrent::filteredReduced<int>(linkedList.begin(),
- linkedList.end(),
- KeepEvenIntegers(),
- IntSumReduce());
- QCOMPARE(sum, 6);
-
- int sum2 = QtConcurrent::filteredReduced<int>(linkedList.begin(),
- linkedList.end(),
- keepEvenIntegers,
- intSumReduce);
- QCOMPARE(sum2, 6);
- }
- {
- int sum = QtConcurrent::filteredReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- KeepEvenIntegers(),
- IntSumReduce());
- QCOMPARE(sum, 6);
-
- int sum2 = QtConcurrent::filteredReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- keepEvenIntegers,
- intSumReduce);
- QCOMPARE(sum2, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced<int>(linkedList, KeepEvenIntegers(), IntSumReduce());
- QCOMPARE(sum, 6);
-
- int sum2 = QtConcurrent::blockingFilteredReduced<int>(linkedList, keepEvenIntegers, intSumReduce);
- QCOMPARE(sum2, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced<int>(linkedList.begin(),
- linkedList.end(),
- KeepEvenIntegers(),
- IntSumReduce());
- QCOMPARE(sum, 6);
-
- int sum2 = QtConcurrent::blockingFilteredReduced<int>(linkedList.begin(),
- linkedList.end(),
- keepEvenIntegers,
- intSumReduce);
- QCOMPARE(sum2, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- KeepEvenIntegers(),
- IntSumReduce());
- QCOMPARE(sum, 6);
-
- int sum2 = QtConcurrent::blockingFilteredReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- keepEvenIntegers,
- intSumReduce);
- QCOMPARE(sum2, 6);
- }
-
- // function-functor
- {
- int sum = QtConcurrent::filteredReduced<int>(linkedList, keepEvenIntegers, IntSumReduce());
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::filteredReduced<int>(linkedList.begin(),
- linkedList.end(),
- keepEvenIntegers,
- IntSumReduce());
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::filteredReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- keepEvenIntegers,
- IntSumReduce());
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced<int>(linkedList, keepEvenIntegers, IntSumReduce());
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced<int>(linkedList.begin(),
- linkedList.end(),
- keepEvenIntegers,
- IntSumReduce());
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- keepEvenIntegers,
- IntSumReduce());
- QCOMPARE(sum, 6);
- }
-
- // functor-function
- {
- int sum = QtConcurrent::filteredReduced(linkedList, KeepEvenIntegers(), intSumReduce);
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::filteredReduced(linkedList.begin(),
- linkedList.end(),
- KeepEvenIntegers(),
- intSumReduce);
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::filteredReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- KeepEvenIntegers(),
- intSumReduce);
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced(linkedList, KeepEvenIntegers(), intSumReduce);
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced(linkedList.begin(),
- linkedList.end(),
- KeepEvenIntegers(),
- intSumReduce);
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- KeepEvenIntegers(),
- intSumReduce);
- QCOMPARE(sum, 6);
- }
-
- // function-function
- {
- int sum = QtConcurrent::filteredReduced(linkedList, keepEvenIntegers, intSumReduce);
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::filteredReduced(linkedList.begin(),
- linkedList.end(),
- keepEvenIntegers,
- intSumReduce);
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::filteredReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- keepEvenIntegers,
- intSumReduce);
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced(linkedList, keepEvenIntegers, intSumReduce);
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced(linkedList.begin(),
- linkedList.end(),
- keepEvenIntegers,
- intSumReduce);
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- keepEvenIntegers,
- intSumReduce);
- QCOMPARE(sum, 6);
- }
-
- // functor-member
- {
- QLinkedList<int> linkedList2 = QtConcurrent::filteredReduced(linkedList, KeepEvenIntegers(), &QLinkedList<int>::append, QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::filteredReduced(linkedList.begin(),
- linkedList.end(),
- KeepEvenIntegers(),
- &QLinkedList<int>::append,
- QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::filteredReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- KeepEvenIntegers(),
- &QLinkedList<int>::append,
- QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFilteredReduced(linkedList, KeepEvenIntegers(), &QLinkedList<int>::append, QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFilteredReduced(linkedList.begin(),
- linkedList.end(),
- KeepEvenIntegers(),
- &QLinkedList<int>::append,
- QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFilteredReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- KeepEvenIntegers(),
- &QLinkedList<int>::append,
- QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
-
- // member-functor
- {
- int sum = QtConcurrent::filteredReduced<int>(numberLinkedList, &Number::isEven, NumberSumReduce());
- QCOMPARE(sum, 6);
-
- int sum2 = QtConcurrent::filteredReduced<int>(QLinkedList<Number>(numberLinkedList),
- &Number::isEven,
- NumberSumReduce());
- QCOMPARE(sum2, 6);
- }
- {
- int sum = QtConcurrent::filteredReduced<int>(numberLinkedList.begin(),
- numberLinkedList.end(),
- &Number::isEven,
- NumberSumReduce());
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::filteredReduced<int>(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::isEven,
- NumberSumReduce());
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced<int>(numberLinkedList, &Number::isEven, NumberSumReduce());
- QCOMPARE(sum, 6);
-
- int sum2 = QtConcurrent::blockingFilteredReduced<int>(QLinkedList<Number>(numberLinkedList),
- &Number::isEven,
- NumberSumReduce());
- QCOMPARE(sum2, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced<int>(numberLinkedList.begin(),
- numberLinkedList.end(),
- &Number::isEven,
- NumberSumReduce());
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced<int>(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::isEven,
- NumberSumReduce());
- QCOMPARE(sum, 6);
- }
-
- // member-member
- {
- QLinkedList<Number> numbers;
- numbers << 1 << 2 << 3 << 4;
- QLinkedList<Number> linkedList2 = QtConcurrent::filteredReduced(numbers,
- &Number::isEven,
- &QLinkedList<Number>::append, QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<Number>() << 2 << 4);
- }
- {
- QLinkedList<Number> numbers;
- numbers << 1 << 2 << 3 << 4;
- QLinkedList<Number> linkedList2 = QtConcurrent::filteredReduced(numbers.begin(),
- numbers.end(),
- &Number::isEven,
- &QLinkedList<Number>::append,
- QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<Number>() << 2 << 4);
- }
- {
- QLinkedList<Number> numbers;
- numbers << 1 << 2 << 3 << 4;
- QLinkedList<Number> linkedList2 = QtConcurrent::filteredReduced(numbers.constBegin(),
- numbers.constEnd(),
- &Number::isEven,
- &QLinkedList<Number>::append,
- QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<Number>() << 2 << 4);
- }
- {
- QLinkedList<Number> numbers;
- numbers << 1 << 2 << 3 << 4;
- QLinkedList<Number> linkedList2 = QtConcurrent::blockingFilteredReduced(numbers,
- &Number::isEven,
- &QLinkedList<Number>::append, QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<Number>() << 2 << 4);
- }
- {
- QLinkedList<Number> numbers;
- numbers << 1 << 2 << 3 << 4;
- QLinkedList<Number> linkedList2 = QtConcurrent::blockingFilteredReduced(numbers.begin(),
- numbers.end(),
- &Number::isEven,
- &QLinkedList<Number>::append,
- QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<Number>() << 2 << 4);
- }
- {
- QLinkedList<Number> numbers;
- numbers << 1 << 2 << 3 << 4;
- QLinkedList<Number> linkedList2 = QtConcurrent::blockingFilteredReduced(numbers.constBegin(),
- numbers.constEnd(),
- &Number::isEven,
- &QLinkedList<Number>::append,
- QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<Number>() << 2 << 4);
- }
-
- // function-member
- {
- QLinkedList<int> linkedList2 = QtConcurrent::filteredReduced(linkedList, keepEvenIntegers, &QLinkedList<int>::append, QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::filteredReduced(linkedList.begin(),
- linkedList.end(),
- keepEvenIntegers,
- &QLinkedList<int>::append,
- QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::filteredReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- keepEvenIntegers,
- &QLinkedList<int>::append,
- QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFilteredReduced(linkedList, keepEvenIntegers, &QLinkedList<int>::append, QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFilteredReduced(linkedList.begin(),
- linkedList.end(),
- keepEvenIntegers,
- &QLinkedList<int>::append,
- QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingFilteredReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- keepEvenIntegers,
- &QLinkedList<int>::append,
- QtConcurrent::OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4);
- }
-
- // member-function
- {
- int sum = QtConcurrent::filteredReduced(numberLinkedList, &Number::isEven, numberSumReduce);
- QCOMPARE(sum, 6);
-
- int sum2 = QtConcurrent::filteredReduced(QLinkedList<Number>(numberLinkedList),
- &Number::isEven,
- numberSumReduce);
- QCOMPARE(sum2, 6);
- }
- {
- int sum = QtConcurrent::filteredReduced(numberLinkedList.begin(),
- numberLinkedList.end(),
- &Number::isEven,
- numberSumReduce);
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::filteredReduced(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::isEven,
- numberSumReduce);
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced(numberLinkedList, &Number::isEven, numberSumReduce);
- QCOMPARE(sum, 6);
-
- int sum2 = QtConcurrent::blockingFilteredReduced(QLinkedList<Number>(numberLinkedList),
- &Number::isEven,
- numberSumReduce);
- QCOMPARE(sum2, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced(numberLinkedList.begin(),
- numberLinkedList.end(),
- &Number::isEven,
- numberSumReduce);
- QCOMPARE(sum, 6);
- }
- {
- int sum = QtConcurrent::blockingFilteredReduced(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::isEven,
- numberSumReduce);
- QCOMPARE(sum, 6);
- }
-
// ### the same as above, with an initial result value
}
diff --git a/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro b/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro
index 170881177d..bbadd1ada1 100644
--- a/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro
+++ b/tests/auto/concurrent/qtconcurrentmap/qtconcurrentmap.pro
@@ -2,7 +2,6 @@ CONFIG += testcase
TARGET = tst_qtconcurrentmap
QT = core testlib concurrent
SOURCES = tst_qtconcurrentmap.cpp
-DEFINES -= QT_NO_LINKED_LIST
# Force C++17 if available
contains(QT_CONFIG, c++1z): CONFIG += c++1z
diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
index d9cbae1ac2..fbcac35fee 100644
--- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
+++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
@@ -164,38 +164,6 @@ void tst_QtConcurrentMap::map()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
}
- // Linked lists and forward iterators
- {
- QLinkedList<int> list;
- list << 1 << 2 << 3;
-
- // functor
- QtConcurrent::map(list, MultiplyBy2InPlace()).waitForFinished();
- QCOMPARE(list, QLinkedList<int>() << 2 << 4 << 6);
- QtConcurrent::map(list.begin(), list.end(), MultiplyBy2InPlace()).waitForFinished();
- QCOMPARE(list, QLinkedList<int>() << 4 << 8 << 12);
-
- // function
- QtConcurrent::map(list, multiplyBy2InPlace).waitForFinished();
- QCOMPARE(list, QLinkedList<int>() << 8 << 16 << 24);
- QtConcurrent::map(list.begin(), list.end(), multiplyBy2InPlace).waitForFinished();
- QCOMPARE(list, QLinkedList<int>() << 16 << 32 << 48);
-
- // bound function
- QtConcurrent::map(list, multiplyBy2InPlace).waitForFinished();
- QCOMPARE(list, QLinkedList<int>() << 32 << 64 << 96);
- QtConcurrent::map(list.begin(), list.end(), multiplyBy2InPlace).waitForFinished();
- QCOMPARE(list, QLinkedList<int>() << 64 << 128 << 192);
-
- // member function
- QLinkedList<Number> numberList;
- numberList << 1 << 2 << 3;
- QtConcurrent::map(numberList, &Number::multiplyBy2).waitForFinished();
- QCOMPARE(numberList, QLinkedList<Number>() << 2 << 4 << 6);
- QtConcurrent::map(numberList.begin(), numberList.end(), &Number::multiplyBy2).waitForFinished();
- QCOMPARE(numberList, QLinkedList<Number>() << 4 << 8 << 12);
- }
-
#if 0
// not allowed: map() with immutable sequences makes no sense
{
@@ -296,38 +264,6 @@ void tst_QtConcurrentMap::blocking_map()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
}
- // Linked lists and forward iterators
- {
- QLinkedList<int> list;
- list << 1 << 2 << 3;
-
- // functor
- QtConcurrent::blockingMap(list, MultiplyBy2InPlace());
- QCOMPARE(list, QLinkedList<int>() << 2 << 4 << 6);
- QtConcurrent::blockingMap(list.begin(), list.end(), MultiplyBy2InPlace());
- QCOMPARE(list, QLinkedList<int>() << 4 << 8 << 12);
-
- // function
- QtConcurrent::blockingMap(list, multiplyBy2InPlace);
- QCOMPARE(list, QLinkedList<int>() << 8 << 16 << 24);
- QtConcurrent::blockingMap(list.begin(), list.end(), multiplyBy2InPlace);
- QCOMPARE(list, QLinkedList<int>() << 16 << 32 << 48);
-
- // bound function
- QtConcurrent::blockingMap(list, multiplyBy2InPlace);
- QCOMPARE(list, QLinkedList<int>() << 32 << 64 << 96);
- QtConcurrent::blockingMap(list.begin(), list.end(), multiplyBy2InPlace);
- QCOMPARE(list, QLinkedList<int>() << 64 << 128 << 192);
-
- // member function
- QLinkedList<Number> numberList;
- numberList << 1 << 2 << 3;
- QtConcurrent::blockingMap(numberList, &Number::multiplyBy2);
- QCOMPARE(numberList, QLinkedList<Number>() << 2 << 4 << 6);
- QtConcurrent::blockingMap(numberList.begin(), numberList.end(), &Number::multiplyBy2);
- QCOMPARE(numberList, QLinkedList<Number>() << 4 << 8 << 12);
- }
-
#if 0
// not allowed: map() with immutable sequences makes no sense
{
@@ -424,12 +360,8 @@ void tst_QtConcurrentMap::mapped()
{
QList<int> list;
list << 1 << 2 << 3;
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3;
QList<Number> numberList;
numberList << 1 << 2 << 3;
- QLinkedList<Number> numberLinkedList;
- numberLinkedList << 1 << 2 << 3;
// functor
{
@@ -447,22 +379,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
}
- {
- QList<int> list2 = QtConcurrent::mapped(linkedList, MultiplyBy2()).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<int>() << 2 << 4 << 6);
-
- QList<int> list3 = QtConcurrent::mapped(linkedList.constBegin(),
- linkedList.constEnd(),
- MultiplyBy2()).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<int>() << 2 << 4 << 6);
-
- QList<int> list4 =
- QtConcurrent::mapped(QLinkedList<int>(linkedList), MultiplyBy2()).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
- }
// function
{
@@ -480,22 +396,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
}
- {
- QList<int> list2 = QtConcurrent::mapped(linkedList, multiplyBy2).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<int>() << 2 << 4 << 6);
-
- QList<int> list3 = QtConcurrent::mapped(linkedList.constBegin(),
- linkedList.constEnd(),
- multiplyBy2).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<int>() << 2 << 4 << 6);
-
- QList<int> list4 =
- QtConcurrent::mapped(QLinkedList<int>(linkedList), multiplyBy2).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
- }
// bound function
{
@@ -513,23 +413,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
}
- {
- QList<int> list2 = QtConcurrent::mapped(linkedList, multiplyBy2).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<int>() << 2 << 4 << 6);
-
- QList<int> list3 = QtConcurrent::mapped(linkedList.constBegin(),
- linkedList.constEnd(),
- multiplyBy2)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<int>() << 2 << 4 << 6);
-
- QList<int> list4 = QtConcurrent::mapped(QLinkedList<int>(linkedList), multiplyBy2)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
- }
// const member function
{
@@ -551,25 +434,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(numberList, QList<Number>() << 1 << 2 << 3);
QCOMPARE(numberList4, QList<Number>() << 2 << 4 << 6);
}
- {
- QList<Number> numberList2 = QtConcurrent::mapped(numberLinkedList, &Number::multipliedBy2)
- .results();
- QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
- QCOMPARE(numberList2, QList<Number>() << 2 << 4 << 6);
-
- QList<Number> numberList3 = QtConcurrent::mapped(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::multipliedBy2)
- .results();
- QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
- QCOMPARE(numberList3, QList<Number>() << 2 << 4 << 6);
-
- QList<Number> numberList4 = QtConcurrent::mapped(QLinkedList<Number>(numberLinkedList),
- &Number::multipliedBy2)
- .results();
- QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
- QCOMPARE(numberList4, QList<Number>() << 2 << 4 << 6);
- }
// change the value_type, same container
@@ -592,24 +456,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
}
- {
- QList<double> list2 = QtConcurrent::mapped(linkedList, IntToDouble()).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<double>() << 1.0 << 2.0 << 3.0);
-
- QList<double> list3 = QtConcurrent::mapped(linkedList.constBegin(),
- linkedList.constEnd(),
- IntToDouble())
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<double>() << 1.0 << 2.0 << 3.0);
-
- QList<double> list4 = QtConcurrent::mapped(QLinkedList<int>(linkedList),
- IntToDouble())
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
- }
// function
{
@@ -628,23 +474,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
}
- {
- QList<double> list2 = QtConcurrent::mapped(linkedList, intToDouble).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<double>() << 1.0 << 2.0 << 3.0);
-
- QList<double> list3 = QtConcurrent::mapped(linkedList.constBegin(),
- linkedList.constEnd(),
- intToDouble)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<double>() << 1.0 << 2.0 << 3.0);
-
- QList<double> list4 = QtConcurrent::mapped(QLinkedList<int>(linkedList), intToDouble)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
- }
// bound function
{
@@ -666,25 +495,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
}
- {
- QList<double> list2 = QtConcurrent::mapped(linkedList, intToDouble).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<double>() << 1.0 << 2.0 << 3.0);
-
- QList<double> list3 = QtConcurrent::mapped(linkedList.constBegin(),
- linkedList.constEnd(),
- intToDouble)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<double>() << 1.0 << 2.0 << 3.0);
-
-
- QList<double> list4 = QtConcurrent::mapped(QLinkedList<int>(linkedList),
- intToDouble)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
- }
// const member function
{
@@ -704,24 +514,6 @@ void tst_QtConcurrentMap::mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<QString>() << "1" << "2" << "3");
}
- {
- QList<QString> list2 = QtConcurrent::mapped(numberLinkedList, &Number::toString).results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list2, QList<QString>() << "1" << "2" << "3");
-
- QList<QString> list3 = QtConcurrent::mapped(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::toString)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list3, QList<QString>() << "1" << "2" << "3");
-
- QList<QString> list4 = QtConcurrent::mapped(QLinkedList<Number>(numberLinkedList),
- &Number::toString)
- .results();
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(list4, QList<QString>() << "1" << "2" << "3");
- }
// change the value_type
{
@@ -786,12 +578,8 @@ void tst_QtConcurrentMap::blocking_mapped()
{
QList<int> list;
list << 1 << 2 << 3;
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3;
QList<Number> numberList;
numberList << 1 << 2 << 3;
- QLinkedList<Number> numberLinkedList;
- numberLinkedList << 1 << 2 << 3;
// functor
{
@@ -809,21 +597,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingMapped(linkedList, MultiplyBy2());
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4 << 6);
-
- QLinkedList<int> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<int> >(linkedList.constBegin(),
- linkedList.constEnd(),
- MultiplyBy2());
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<int>() << 2 << 4 << 6);
-
- QLinkedList<int> linkedList4 = QtConcurrent::blockingMapped(QLinkedList<int>(linkedList), MultiplyBy2());
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<int>() << 2 << 4 << 6);
- }
// function
{
@@ -841,21 +614,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingMapped(linkedList, multiplyBy2);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4 << 6);
-
- QLinkedList<int> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<int> >(linkedList.constBegin(),
- linkedList.constEnd(),
- multiplyBy2);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<int>() << 2 << 4 << 6);
-
- QLinkedList<int> linkedList4 = QtConcurrent::blockingMapped(QLinkedList<int>(linkedList), multiplyBy2);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<int>() << 2 << 4 << 6);
- }
// bound function
{
@@ -873,21 +631,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 2 << 4 << 6);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingMapped(linkedList, multiplyBy2);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<int>() << 2 << 4 << 6);
-
- QLinkedList<int> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<int> >(linkedList.constBegin(),
- linkedList.constEnd(),
- multiplyBy2);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<int>() << 2 << 4 << 6);
-
- QLinkedList<int> linkedList4 = QtConcurrent::blockingMapped(QLinkedList<int>(linkedList), multiplyBy2);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<int>() << 2 << 4 << 6);
- }
// const member function
{
@@ -906,22 +649,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(numberList, QList<Number>() << 1 << 2 << 3);
QCOMPARE(numberList4, QList<Number>() << 2 << 4 << 6);
}
- {
- QLinkedList<Number> numberLinkedList2 = QtConcurrent::blockingMapped(numberLinkedList, &Number::multipliedBy2);
- QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
- QCOMPARE(numberLinkedList2, QLinkedList<Number>() << 2 << 4 << 6);
-
- QLinkedList<Number> numberLinkedList3 = QtConcurrent::blockingMapped<QLinkedList<Number> >(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::multipliedBy2);
- QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
- QCOMPARE(numberLinkedList3, QLinkedList<Number>() << 2 << 4 << 6);
-
- QLinkedList<Number> numberLinkedList4 = QtConcurrent::blockingMapped(QLinkedList<Number>(numberLinkedList),
- &Number::multipliedBy2);
- QCOMPARE(numberLinkedList, QLinkedList<Number>() << 1 << 2 << 3);
- QCOMPARE(numberLinkedList4, QLinkedList<Number>() << 2 << 4 << 6);
- }
// change the value_type, same container
@@ -942,22 +669,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
}
- {
- QLinkedList<double> linkedList2 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList, IntToDouble());
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
-
- QLinkedList<double> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList.constBegin(),
- linkedList.constEnd(),
- IntToDouble());
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
-
- QLinkedList<double> linkedList4 = QtConcurrent::blockingMapped<QLinkedList<double> >(QLinkedList<int>(linkedList),
- IntToDouble());
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
- }
// function
{
@@ -975,21 +686,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
}
- {
- QLinkedList<double> linkedList2 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList, intToDouble);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
-
- QLinkedList<double> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList.constBegin(),
- linkedList.constEnd(),
- intToDouble);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
-
- QLinkedList<double> linkedList4 = QtConcurrent::blockingMapped<QLinkedList<double> >(QLinkedList<int>(linkedList), intToDouble);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
- }
// bound function
{
@@ -1009,23 +705,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<double>() << 1.0 << 2.0 << 3.0);
}
- {
- QLinkedList<double> linkedList2 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList, intToDouble);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
-
- QLinkedList<double> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<double> >(linkedList.constBegin(),
- linkedList.constEnd(),
- intToDouble);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
-
-
- QLinkedList<double> linkedList4 = QtConcurrent::blockingMapped<QLinkedList<double> >(QLinkedList<int>(linkedList),
- intToDouble);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<double>() << 1.0 << 2.0 << 3.0);
- }
// const member function
{
@@ -1045,23 +724,6 @@ void tst_QtConcurrentMap::blocking_mapped()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<QString>() << "1" << "2" << "3");
}
- {
- QLinkedList<QString> linkedList2 =
- QtConcurrent::blockingMapped<QLinkedList<QString> >(numberLinkedList, &Number::toString);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<QString>() << "1" << "2" << "3");
-
- QLinkedList<QString> linkedList3 = QtConcurrent::blockingMapped<QLinkedList<QString> >(numberLinkedList.constBegin(),
- numberLinkedList.constEnd()
- , &Number::toString);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<QString>() << "1" << "2" << "3");
-
- QLinkedList<QString> linkedList4 =
- QtConcurrent::blockingMapped<QLinkedList<QString> >(QLinkedList<Number>(numberLinkedList), &Number::toString);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<QString>() << "1" << "2" << "3");
- }
// change the value_type
{
@@ -1240,12 +902,8 @@ void tst_QtConcurrentMap::mappedReduced()
{
QList<int> list;
list << 1 << 2 << 3;
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3;
QList<Number> numberList;
numberList << 1 << 2 << 3;
- QLinkedList<Number> numberLinkedList;
- numberLinkedList << 1 << 2 << 3;
// test Q_DECLARE_OPERATORS_FOR_FLAGS
QtConcurrent::ReduceOptions opt = (QtConcurrent::UnorderedReduce | QtConcurrent::SequentialReduce);
@@ -1277,31 +935,6 @@ void tst_QtConcurrentMap::mappedReduced()
intSumReduce);
QCOMPARE(sum6, 14);
}
- {
- int sum = QtConcurrent::mappedReduced<int>(linkedList, IntSquare(), IntSumReduce());
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::mappedReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- IntSquare(),
- IntSumReduce());
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::mappedReduced<int>(QLinkedList<int>(linkedList), IntSquare(), IntSumReduce());
- QCOMPARE(sum3, 14);
-
- int sum4 = QtConcurrent::mappedReduced<int>(linkedList, intSquare, intSumReduce);
- QCOMPARE(sum4, 14);
- int sum5 = QtConcurrent::mappedReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- intSquare,
- intSumReduce);
- QCOMPARE(sum5, 14);
-
- int sum6 = QtConcurrent::mappedReduced<int>(QLinkedList<int>(linkedList),
- intSquare,
- intSumReduce);
- QCOMPARE(sum6, 14);
- }
// function-functor
{
@@ -1316,18 +949,6 @@ void tst_QtConcurrentMap::mappedReduced()
int sum3 = QtConcurrent::mappedReduced<int>(QList<int>(list), intSquare, IntSumReduce());
QCOMPARE(sum3, 14);
}
- {
- int sum = QtConcurrent::mappedReduced<int>(linkedList, intSquare, IntSumReduce());
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::mappedReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- intSquare,
- IntSumReduce());
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::mappedReduced<int>(QLinkedList<int>(linkedList), intSquare, IntSumReduce());
- QCOMPARE(sum3, 14);
- }
// functor-function
{
@@ -1342,18 +963,6 @@ void tst_QtConcurrentMap::mappedReduced()
int sum3 = QtConcurrent::mappedReduced(QList<int>(list), IntSquare(), intSumReduce);
QCOMPARE(sum3, 14);
}
- {
- int sum = QtConcurrent::mappedReduced(linkedList, IntSquare(), intSumReduce);
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::mappedReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- IntSquare(),
- intSumReduce);
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::mappedReduced(QLinkedList<int>(linkedList), IntSquare(), intSumReduce);
- QCOMPARE(sum3, 14);
- }
// function-function
{
@@ -1368,18 +977,6 @@ void tst_QtConcurrentMap::mappedReduced()
int sum3 = QtConcurrent::mappedReduced(QList<int>(list), intSquare, intSumReduce);
QCOMPARE(sum3, 14);
}
- {
- int sum = QtConcurrent::mappedReduced(linkedList, intSquare, intSumReduce);
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::mappedReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- intSquare,
- intSumReduce);
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::mappedReduced(QLinkedList<int>(linkedList), intSquare, intSumReduce);
- QCOMPARE(sum3, 14);
- }
auto push_back = static_cast<void (QVector<int>::*)(const int &)>(&QVector<int>::push_back);
@@ -1407,29 +1004,6 @@ void tst_QtConcurrentMap::mappedReduced()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::mappedReduced(linkedList,
- IntSquare(),
- &QLinkedList<int>::push_back,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<int>() << 1 << 4 << 9);
-
- QLinkedList<int> linkedList3 = QtConcurrent::mappedReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- IntSquare(),
- &QLinkedList<int>::push_back,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<int>() << 1 << 4 << 9);
-
- QLinkedList<int> linkedList4 = QtConcurrent::mappedReduced(QLinkedList<int>(linkedList),
- IntSquare(),
- &QLinkedList<int>::push_back,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<int>() << 1 << 4 << 9);
- }
// member-functor
{
@@ -1446,20 +1020,6 @@ void tst_QtConcurrentMap::mappedReduced()
IntSumReduce());
QCOMPARE(sum3, 6);
}
- {
- int sum = QtConcurrent::mappedReduced<int>(numberLinkedList, &Number::toInt, IntSumReduce());
- QCOMPARE(sum, 6);
- int sum2 = QtConcurrent::mappedReduced<int>(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::toInt,
- IntSumReduce());
- QCOMPARE(sum2, 6);
-
- int sum3 = QtConcurrent::mappedReduced<int>(QLinkedList<Number>(numberLinkedList),
- &Number::toInt,
- IntSumReduce());
- QCOMPARE(sum3, 6);
- }
// member-member
{
@@ -1481,25 +1041,6 @@ void tst_QtConcurrentMap::mappedReduced()
push_back, OrderedReduce);
QCOMPARE(list4, QList<int>() << 1 << 2 << 3);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::mappedReduced(numberLinkedList,
- &Number::toInt,
- &QLinkedList<int>::push_back,
- OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 1 << 2 << 3);
-
- QLinkedList<int> linkedList3 = QtConcurrent::mappedReduced(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::toInt,
- &QLinkedList<int>::push_back,
- OrderedReduce);
- QCOMPARE(linkedList3, QLinkedList<int>() << 1 << 2 << 3);
-
- QLinkedList<int> linkedList4 = QtConcurrent::mappedReduced(QLinkedList<Number>(numberLinkedList),
- &Number::toInt,
- &QLinkedList<int>::push_back, OrderedReduce);
- QCOMPARE(linkedList4, QLinkedList<int>() << 1 << 2 << 3);
- }
// function-member
{
@@ -1525,29 +1066,6 @@ void tst_QtConcurrentMap::mappedReduced()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::mappedReduced(linkedList,
- intSquare,
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<int>() << 1 << 4 << 9);
-
- QLinkedList<int> linkedList3 = QtConcurrent::mappedReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- intSquare,
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<int>() << 1 << 4 << 9);
-
- QLinkedList<int> linkedList4 = QtConcurrent::mappedReduced(QLinkedList<int>(linkedList),
- intSquare,
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<int>() << 1 << 4 << 9);
- }
// member-function
{
@@ -1566,56 +1084,6 @@ void tst_QtConcurrentMap::mappedReduced()
intSumReduce);
QCOMPARE(sum3, 6);
}
- {
- int sum = QtConcurrent::mappedReduced(numberLinkedList,
- &Number::toInt,
- intSumReduce);
- QCOMPARE(sum, 6);
- int sum2 = QtConcurrent::mappedReduced(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::toInt,
- intSumReduce);
- QCOMPARE(sum2, 6);
-
- int sum3 = QtConcurrent::mappedReduced(QLinkedList<Number>(numberLinkedList),
- &Number::toInt,
- intSumReduce);
- QCOMPARE(sum3, 6);
- }
-
- // linked lists
- {
-
- QLinkedList<int> list;
- list << 1 << 2 << 3;
-
- QLinkedList<Number> numberList;
- numberList << 1 << 2 << 3;
-
- int sum = QtConcurrent::mappedReduced<int>(list, IntSquare(), IntSumReduce());
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::mappedReduced<int>(list.constBegin(),
- list.constEnd(),
- IntSquare(),
- IntSumReduce());
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::mappedReduced<int>(QLinkedList<int>(list), IntSquare(), IntSumReduce());
- QCOMPARE(sum3, 14);
-
- int sum4 = QtConcurrent::mappedReduced<int>(list, intSquare, intSumReduce);
- QCOMPARE(sum4, 14);
- int sum5 = QtConcurrent::mappedReduced<int>(list.constBegin(),
- list.constEnd(),
- intSquare,
- intSumReduce);
- QCOMPARE(sum5, 14);
-
- int sum6 = QtConcurrent::mappedReduced<int>(QLinkedList<int>(list),
- intSquare,
- intSumReduce);
- QCOMPARE(sum6, 14);
- }
// ### the same as above, with an initial result value
}
@@ -1624,12 +1092,8 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
{
QList<int> list;
list << 1 << 2 << 3;
- QLinkedList<int> linkedList;
- linkedList << 1 << 2 << 3;
QList<Number> numberList;
numberList << 1 << 2 << 3;
- QLinkedList<Number> numberLinkedList;
- numberLinkedList << 1 << 2 << 3;
// functor-functor
{
@@ -1657,31 +1121,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
intSumReduce);
QCOMPARE(sum6, 14);
}
- {
- int sum = QtConcurrent::blockingMappedReduced<int>(linkedList, IntSquare(), IntSumReduce());
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::blockingMappedReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- IntSquare(),
- IntSumReduce());
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<int>(linkedList), IntSquare(), IntSumReduce());
- QCOMPARE(sum3, 14);
-
- int sum4 = QtConcurrent::blockingMappedReduced<int>(linkedList, intSquare, intSumReduce);
- QCOMPARE(sum4, 14);
- int sum5 = QtConcurrent::blockingMappedReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- intSquare,
- intSumReduce);
- QCOMPARE(sum5, 14);
-
- int sum6 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<int>(linkedList),
- intSquare,
- intSumReduce);
- QCOMPARE(sum6, 14);
- }
// function-functor
{
@@ -1696,18 +1135,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
int sum3 = QtConcurrent::blockingMappedReduced<int>(QList<int>(list), intSquare, IntSumReduce());
QCOMPARE(sum3, 14);
}
- {
- int sum = QtConcurrent::blockingMappedReduced<int>(linkedList, intSquare, IntSumReduce());
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::blockingMappedReduced<int>(linkedList.constBegin(),
- linkedList.constEnd(),
- intSquare,
- IntSumReduce());
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<int>(linkedList), intSquare, IntSumReduce());
- QCOMPARE(sum3, 14);
- }
// functor-function
{
@@ -1722,18 +1149,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
int sum3 = QtConcurrent::blockingMappedReduced(QList<int>(list), IntSquare(), intSumReduce);
QCOMPARE(sum3, 14);
}
- {
- int sum = QtConcurrent::blockingMappedReduced(linkedList, IntSquare(), intSumReduce);
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::blockingMappedReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- IntSquare(),
- intSumReduce);
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::blockingMappedReduced(QLinkedList<int>(linkedList), IntSquare(), intSumReduce);
- QCOMPARE(sum3, 14);
- }
// function-function
{
@@ -1748,18 +1163,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
int sum3 = QtConcurrent::blockingMappedReduced(QList<int>(list), intSquare, intSumReduce);
QCOMPARE(sum3, 14);
}
- {
- int sum = QtConcurrent::blockingMappedReduced(linkedList, intSquare, intSumReduce);
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::blockingMappedReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- intSquare,
- intSumReduce);
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::blockingMappedReduced(QLinkedList<int>(linkedList), intSquare, intSumReduce);
- QCOMPARE(sum3, 14);
- }
auto push_back = static_cast<void (QVector<int>::*)(const int &)>(&QVector<int>::push_back);
@@ -1787,29 +1190,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingMappedReduced(linkedList,
- IntSquare(),
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<int>() << 1 << 4 << 9);
-
- QLinkedList<int> linkedList3 = QtConcurrent::blockingMappedReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- IntSquare(),
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<int>() << 1 << 4 << 9);
-
- QLinkedList<int> linkedList4 = QtConcurrent::blockingMappedReduced(QLinkedList<int>(linkedList),
- IntSquare(),
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<int>() << 1 << 4 << 9);
- }
// member-functor
{
@@ -1827,20 +1207,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
IntSumReduce());
QCOMPARE(sum3, 6);
}
- {
- int sum = QtConcurrent::blockingMappedReduced<int>(numberLinkedList, &Number::toInt, IntSumReduce());
- QCOMPARE(sum, 6);
- int sum2 = QtConcurrent::blockingMappedReduced<int>(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::toInt,
- IntSumReduce());
- QCOMPARE(sum2, 6);
-
- int sum3 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<Number>(numberLinkedList),
- &Number::toInt,
- IntSumReduce());
- QCOMPARE(sum3, 6);
- }
// member-member
{
@@ -1862,25 +1228,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
push_back, OrderedReduce);
QCOMPARE(list4, QList<int>() << 1 << 2 << 3);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingMappedReduced(numberLinkedList,
- &Number::toInt,
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList2, QLinkedList<int>() << 1 << 2 << 3);
-
- QLinkedList<int> linkedList3 = QtConcurrent::blockingMappedReduced(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::toInt,
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList3, QLinkedList<int>() << 1 << 2 << 3);
-
- QLinkedList<int> linkedList4 = QtConcurrent::blockingMappedReduced(QLinkedList<Number>(numberLinkedList),
- &Number::toInt,
- &QLinkedList<int>::append, OrderedReduce);
- QCOMPARE(linkedList4, QLinkedList<int>() << 1 << 2 << 3);
- }
// function-member
{
@@ -1906,29 +1253,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QCOMPARE(list4, QList<int>() << 1 << 4 << 9);
}
- {
- QLinkedList<int> linkedList2 = QtConcurrent::blockingMappedReduced(linkedList,
- intSquare,
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList2, QLinkedList<int>() << 1 << 4 << 9);
-
- QLinkedList<int> linkedList3 = QtConcurrent::blockingMappedReduced(linkedList.constBegin(),
- linkedList.constEnd(),
- intSquare,
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList3, QLinkedList<int>() << 1 << 4 << 9);
-
- QLinkedList<int> linkedList4 = QtConcurrent::blockingMappedReduced(QLinkedList<int>(linkedList),
- intSquare,
- &QLinkedList<int>::append,
- OrderedReduce);
- QCOMPARE(linkedList, QLinkedList<int>() << 1 << 2 << 3);
- QCOMPARE(linkedList4, QLinkedList<int>() << 1 << 4 << 9);
- }
// member-function
{
@@ -1947,56 +1271,6 @@ void tst_QtConcurrentMap::blocking_mappedReduced()
intSumReduce);
QCOMPARE(sum3, 6);
}
- {
- int sum = QtConcurrent::blockingMappedReduced(numberLinkedList,
- &Number::toInt,
- intSumReduce);
- QCOMPARE(sum, 6);
- int sum2 = QtConcurrent::blockingMappedReduced(numberLinkedList.constBegin(),
- numberLinkedList.constEnd(),
- &Number::toInt,
- intSumReduce);
- QCOMPARE(sum2, 6);
-
- int sum3 = QtConcurrent::blockingMappedReduced(QLinkedList<Number>(numberLinkedList),
- &Number::toInt,
- intSumReduce);
- QCOMPARE(sum3, 6);
- }
-
- // linked lists
- {
-
- QLinkedList<int> list;
- list << 1 << 2 << 3;
-
- QLinkedList<Number> numberList;
- numberList << 1 << 2 << 3;
-
- int sum = QtConcurrent::blockingMappedReduced<int>(list, IntSquare(), IntSumReduce());
- QCOMPARE(sum, 14);
- int sum2 = QtConcurrent::blockingMappedReduced<int>(list.constBegin(),
- list.constEnd(),
- IntSquare(),
- IntSumReduce());
- QCOMPARE(sum2, 14);
-
- int sum3 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<int>(list), IntSquare(), IntSumReduce());
- QCOMPARE(sum3, 14);
-
- int sum4 = QtConcurrent::blockingMappedReduced<int>(list, intSquare, intSumReduce);
- QCOMPARE(sum4, 14);
- int sum5 = QtConcurrent::blockingMappedReduced<int>(list.constBegin(),
- list.constEnd(),
- intSquare,
- intSumReduce);
- QCOMPARE(sum5, 14);
-
- int sum6 = QtConcurrent::blockingMappedReduced<int>(QLinkedList<int>(list),
- intSquare,
- intSumReduce);
- QCOMPARE(sum6, 14);
- }
// ### the same as above, with an initial result value
}
diff --git a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
index 6f9dcc08f9..f997a40119 100644
--- a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
+++ b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp
@@ -27,7 +27,6 @@
****************************************************************************/
#include <QtTest>
-#include <qlinkedlist.h>
#include <qobject.h>
#include <qrandom.h>
#include <qvector.h>
diff --git a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro
index 4856b138c3..56b8c071c3 100644
--- a/tests/auto/corelib/kernel/qmetatype/qmetatype.pro
+++ b/tests/auto/corelib/kernel/qmetatype/qmetatype.pro
@@ -5,7 +5,6 @@ INCLUDEPATH += $$PWD/../../../other/qvariant_common
SOURCES = tst_qmetatype.cpp
TESTDATA=./typeFlags.bin
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
-DEFINES -= QT_NO_LINKED_LIST
msvc|winrt {
# Prevents "fatal error C1128: number of sections exceeded object file format limit".
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index 4e30f210b1..73cebb7f4a 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -1742,7 +1742,6 @@ void tst_QMetaType::automaticTemplateRegistration()
#define FOR_EACH_1ARG_TEMPLATE_TYPE(F, TYPE) \
F(QList, TYPE) \
F(QVector, TYPE) \
- F(QLinkedList, TYPE) \
F(QVector, TYPE) \
F(QVector, TYPE) \
F(QQueue, TYPE) \
diff --git a/tests/auto/corelib/kernel/qvariant/qvariant.pro b/tests/auto/corelib/kernel/qvariant/qvariant.pro
index 0b5280df86..a620be0091 100644
--- a/tests/auto/corelib/kernel/qvariant/qvariant.pro
+++ b/tests/auto/corelib/kernel/qvariant/qvariant.pro
@@ -5,7 +5,6 @@ INCLUDEPATH += $$PWD/../../../other/qvariant_common
SOURCES = tst_qvariant.cpp
RESOURCES += qvariant.qrc
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
-DEFINES -= QT_NO_LINKED_LIST
qtConfig(c++14): CONFIG += c++14
qtConfig(c++1z): CONFIG += c++1z
!qtConfig(doubleconversion):!qtConfig(system-doubleconversion) {
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index b8baa1cde1..265ae166c1 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -49,7 +49,6 @@
#if __has_include(<variant>) && __cplusplus >= 201703L
#include <variant>
#endif
-#include <QLinkedList>
#include <QRegularExpression>
#include <QDir>
#include <QBuffer>
@@ -3521,13 +3520,6 @@ void tst_QVariant::moreCustomTypes()
data << (QSet<int>() << 42);
PLAY_WITH_VARIANT(data, false, QString(), 0, false);
}
-
- {
- QList<QLinkedList<int> > data;
- PLAY_WITH_VARIANT(data, false, QString(), 0, false);
- data << (QLinkedList<int>() << 42);
- PLAY_WITH_VARIANT(data, false, QString(), 0, false);
- }
}
void tst_QVariant::movabilityTest()
diff --git a/tests/auto/corelib/serialization/qdatastream/qdatastream.pro b/tests/auto/corelib/serialization/qdatastream/qdatastream.pro
index 469d689f3f..25f8b889a0 100644
--- a/tests/auto/corelib/serialization/qdatastream/qdatastream.pro
+++ b/tests/auto/corelib/serialization/qdatastream/qdatastream.pro
@@ -3,8 +3,6 @@ TARGET = tst_qdatastream
QT += testlib
SOURCES = tst_qdatastream.cpp
-DEFINES -= QT_NO_LINKED_LIST
-
TESTDATA += datastream.q42
android:!android-embedded {
diff --git a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
index 2f812a9952..d777d69d3c 100644
--- a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp
@@ -186,7 +186,7 @@ private slots:
void status_QHash_QMap();
- void status_QLinkedList_QList_QVector();
+ void status_QList_QVector();
void streamToAndFromQByteArray();
@@ -3172,24 +3172,6 @@ void tst_QDataStream::status_QHash_QMap()
} \
} \
{ \
- LinkedList expectedLinkedList; \
- for (int i = 0; i < expectedList.count(); ++i) \
- expectedLinkedList << expectedList.at(i); \
- QByteArray ba = byteArray; \
- QDataStream stream(&ba, QIODevice::ReadOnly); \
- if (inTransaction) \
- stream.startTransaction(); \
- stream.setStatus(initialStatus); \
- stream >> linkedList; \
- QCOMPARE((int)stream.status(), (int)expectedStatus); \
- if (!inTransaction || stream.commitTransaction()) { \
- QCOMPARE(linkedList.size(), expectedLinkedList.size()); \
- QCOMPARE(linkedList, expectedLinkedList); \
- } else { \
- QVERIFY(linkedList.isEmpty()); \
- } \
- } \
- { \
Vector expectedVector; \
for (int i = 0; i < expectedList.count(); ++i) \
expectedVector << expectedList.at(i); \
@@ -3211,12 +3193,10 @@ void tst_QDataStream::status_QHash_QMap()
break; \
}
-void tst_QDataStream::status_QLinkedList_QList_QVector()
+void tst_QDataStream::status_QList_QVector()
{
- typedef QLinkedList<QString> LinkedList;
typedef QList<QString> List;
typedef QVector<QString> Vector;
- LinkedList linkedList;
List list;
Vector vector;
diff --git a/tests/auto/corelib/tools/CMakeLists.txt b/tests/auto/corelib/tools/CMakeLists.txt
index 534bd7928a..f1967c3664 100644
--- a/tests/auto/corelib/tools/CMakeLists.txt
+++ b/tests/auto/corelib/tools/CMakeLists.txt
@@ -17,7 +17,6 @@ add_subdirectory(qhash)
# add_subdirectory(qhash_strictiterators) # special case not ported
add_subdirectory(qhashfunctions)
# add_subdirectory(qline) # special case not ported
-add_subdirectory(qlinkedlist)
# add_subdirectory(qlist) # special case no longer exists
# add_subdirectory(qlist_strictiterators) # special case not ported
add_subdirectory(qmakearray)
diff --git a/tests/auto/corelib/tools/collections/collections.pro b/tests/auto/corelib/tools/collections/collections.pro
index d5e4e226b5..0182a0c837 100644
--- a/tests/auto/corelib/tools/collections/collections.pro
+++ b/tests/auto/corelib/tools/collections/collections.pro
@@ -4,5 +4,4 @@ SOURCES += tst_collections.cpp
QT = core testlib
# This test does not work with strict iterators
-DEFINES -= QT_NO_LINKED_LIST
DEFINES -= QT_NO_JAVA_STYLE_ITERATORS
diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp
index f319244bd3..6fcf726c21 100644
--- a/tests/auto/corelib/tools/collections/tst_collections.cpp
+++ b/tests/auto/corelib/tools/collections/tst_collections.cpp
@@ -32,7 +32,6 @@
static QCache<int, int> *cacheX;
static QHash<int, int> *hashX;
-static QLinkedList<int> *linkedListX;
static QList<int> *listX;
static QMap<int, int> *mapX;
static QMultiHash<int, int> *multiHashX;
@@ -49,7 +48,6 @@ void foo()
{
cacheX = 0;
hashX = 0;
- linkedListX = 0;
listX = 0;
mapX = 0;
multiHashX = 0;
@@ -71,7 +69,6 @@ void foo()
#include "qbytearray.h"
#include "qcache.h"
#include "qhash.h"
-#include "qlinkedlist.h"
#include "qlist.h"
#include "qmap.h"
#include "qpair.h"
@@ -92,7 +89,6 @@ private slots:
void typeinfo();
void qstring();
void list();
- void linkedList();
void vector();
void byteArray();
void stack();
@@ -105,7 +101,6 @@ private slots:
#endif
void pair();
void sharableQList();
- void sharableQLinkedList();
void sharableQVector();
void sharableQMap();
void sharableQHash();
@@ -117,8 +112,6 @@ private slots:
void vector_stl();
void list_stl_data();
void list_stl();
- void linkedlist_stl_data();
- void linkedlist_stl();
void q_init();
void pointersize();
void containerInstantiation();
@@ -725,228 +718,6 @@ void tst_Collections::list()
}
}
-void tst_Collections::linkedList()
-{
- {
- QLinkedList<int> list;
- QVERIFY(list.isEmpty());
- list.append(1);
- list.push_back(2);
- list += (3);
- list << 4 << 5 << 6;
- QVERIFY(!list.isEmpty());
- QVERIFY(list.size() == 6);
- {
- int sum = 0;
- QLinkedListIterator<int> i = list;
- while (i.hasNext()) {
- sum += i.next();
- }
- QVERIFY(sum == 21);
- }
- {
- int sum = 0;
- QLinkedList<int>::const_iterator i = list.begin();
- while (i != list.end())
- sum += *i++;
- QVERIFY(sum == 21);
- }
- {
- QMutableLinkedListIterator<int> i = list;
- while (i.hasNext())
- i.setValue(2*i.next());
- }
- {
- int sum = 0;
- QLinkedListIterator<int> i = list;
- i.toBack();
- while (i.hasPrevious())
- sum += i.previous();
- QVERIFY(sum == 2*21);
- }
- {
- QMutableLinkedListIterator<int> i = list;
- i.toBack();
- while (i.hasPrevious())
- i.setValue(2*i.previous());
- }
- {
- int sum = 0;
- QLinkedListIterator<int> i = list;
- i.toBack();
- while (i.hasPrevious())
- sum += i.previous();
- QVERIFY(sum == 2*2*21);
- }
- {
- QMutableLinkedListIterator<int> i = list;
- while (i.hasNext()) {
- int a = i.next();
- i.insert(a);
- }
- }
- {
- int sum = 0;
- QLinkedList<int>::iterator i = list.begin();
- while (i != list.end())
- sum += *i++;
- QVERIFY(sum == 2*2*2*21);
- }
- {
- int duplicates = 0;
- QLinkedListIterator<int> i = list;
- while (i.hasNext()) {
- int a = i.next();
- if (i.hasNext() && a == i.peekNext())
- duplicates++;
- }
- QVERIFY(duplicates == 6);
- }
- {
- int duplicates = 0;
- QLinkedListIterator<int> i = list;
- i.toBack();
- while (i.hasPrevious()) {
- int a = i.previous();
- if (i.hasPrevious() && a == i.peekPrevious())
- duplicates++;
- }
- QVERIFY(duplicates == 6);
- }
- {
- QMutableLinkedListIterator<int> i = list;
- while (i.hasNext()) {
- int a = i.next();
- if (i.hasNext() &&
- i.peekNext() == a)
- i.remove();
- }
- }
- {
- int duplicates = 0;
- QMutableLinkedListIterator<int> i = list;
- i.toBack();
- while (i.hasPrevious()) {
- int a = i.previous();
- if (i.hasPrevious() && a == i.peekPrevious())
- duplicates++;
- }
- QVERIFY(duplicates == 0);
- }
- {
- QVERIFY(list.size() == 6);
- QMutableLinkedListIterator<int> i = list;
- while (i.hasNext()) {
- int a = i.peekNext();
- i.insert(42);
- QVERIFY(i.peekPrevious() == 42 && i.peekNext() == a);
- i.next();
- }
- QVERIFY(list.size() == 12);
- i.toFront();
- while (i.findNext(42))
- i.remove();
- }
- {
- QLinkedList<int> l;
- l << 4 << 8 << 12 << 16 << 20 << 24;
- QVERIFY(l == list);
- QLinkedList<int> copy = list;
- list += list;
- QVERIFY(l != list && l.size() == list.size()/2 && l == copy);
- l += copy;
- QVERIFY(l == list);
- list = copy;
- }
- {
- QLinkedList<int> copy = list;
- list.prepend(999);
- list.append(999);
- QVERIFY(list.contains(999));
- QVERIFY(list.count(999) == 2);
- list.removeAll(999);
- QVERIFY(list == copy);
- }
- {
- QLinkedList<QString> list;
- list << "one" << "two" << "three" << "four" << "five" << "six";
- while (!list.isEmpty())
- list.removeAll(list.first());
- }
- {
- QLinkedList<QString> list;
- list << "one" << "two" << "one" << "two";
- QVERIFY(!list.removeOne("three"));
- QVERIFY(list.removeOne("two"));
- QCOMPARE(list, QLinkedList<QString>() << "one" << "one" << "two");;
- QVERIFY(list.removeOne("two"));
- QCOMPARE(list, QLinkedList<QString>() << "one" << "one");
- QVERIFY(!list.removeOne("two"));
- QCOMPARE(list, QLinkedList<QString>() << "one" << "one");
- QVERIFY(list.removeOne("one"));
- QCOMPARE(list, QLinkedList<QString>() << "one");
- QVERIFY(list.removeOne("one"));
- QVERIFY(list.isEmpty());
- QVERIFY(!list.removeOne("one"));
- QVERIFY(list.isEmpty());
- }
- {
- list.clear();
- QVERIFY(list.isEmpty());
- QVERIFY(list.begin() == list.end());
- QLinkedListIterator<int> i(list);
- QVERIFY(!i.hasNext() && !i.hasPrevious());
- }
- }
-
- {
- QLinkedList<QString> list;
- list.append("Hello");
-
- QLinkedList<QString>::iterator it = list.begin();
- QVERIFY((*it)[0] == QChar('H'));
- QVERIFY(it->constData()[0] == QChar('H'));
- it->replace(QChar('H'), QChar('X'));
- QCOMPARE(list.first(), QLatin1String("Xello"));
-
- QLinkedList<QString>::const_iterator cit = list.constBegin();
- QCOMPARE((*cit).toLower(), QLatin1String("xello"));
- QCOMPARE(cit->toUpper(), QLatin1String("XELLO"));
-
- cit = list.cbegin();
- QCOMPARE((*cit).toLower(), QLatin1String("xello"));
- QCOMPARE(cit->toUpper(), QLatin1String("XELLO"));
- }
-
- {
- QLinkedList<QString> list;
- list << "alpha" << "beta";
- list += list;
- QVERIFY(list.size() == 4);
- QCOMPARE(*list.begin(), QLatin1String("alpha"));
- QCOMPARE(*(list.begin() + 1), QLatin1String("beta"));
- QCOMPARE(*(list.begin() + 2), QLatin1String("alpha"));
- QCOMPARE(*(list.begin() + 3), QLatin1String("beta"));
- }
-
- {
- QLinkedList<int> a;
- QCOMPARE(a.startsWith(1), false);
- QCOMPARE(a.endsWith(1), false);
- a.append(1);
- QCOMPARE(a.startsWith(1), true);
- QCOMPARE(a.startsWith(2), false);
- QCOMPARE(a.endsWith(1), true);
- QCOMPARE(a.endsWith(2), false);
- a.append(2);
- QCOMPARE(a.startsWith(1), true);
- QCOMPARE(a.startsWith(2), false);
- QCOMPARE(a.endsWith(1), false);
- QCOMPARE(a.endsWith(2), true);
- }
-};
-
-
void tst_Collections::vector()
{
QVector<int> v1;
@@ -2311,12 +2082,6 @@ void populate(QList<int> &container)
}
template <>
-void populate(QLinkedList<int> &container)
-{
- container << 1 << 2 << 4 << 8;
-}
-
-template <>
void populate(QMap<int, int> &container)
{
container.insert(1, 1);
@@ -2405,11 +2170,6 @@ void tst_Collections::sharableQList()
TEST_SEQUENTIAL_CONTAINER(List);
}
-void tst_Collections::sharableQLinkedList()
-{
- TEST_SEQUENTIAL_CONTAINER(LinkedList);
-}
-
void tst_Collections::sharableQVector()
{
TEST_SEQUENTIAL_CONTAINER(Vector);
@@ -2729,7 +2489,6 @@ void tst_Collections::constAndNonConstStlIterators()
{
testListLikeStlIterators<QList<int> >();
testListLikeStlIterators<QStringList >();
- testLinkedListLikeStlIterators<QLinkedList<int> >();
testListLikeStlIterators<QVector<int> >();
testMapLikeStlIterators<QMap<QString, QString> >();
testMapLikeStlIterators<QMultiMap<QString, QString> >();
@@ -2772,31 +2531,6 @@ void tst_Collections::vector_stl()
QCOMPARE(QVector<QString>(stdVector.begin(), stdVector.end()), vector);
}
-void tst_Collections::linkedlist_stl_data()
-{
- list_stl_data();
-}
-
-void tst_Collections::linkedlist_stl()
-{
- QFETCH(QStringList, elements);
-
- QLinkedList<QString> list;
- for (int i = 0; i < elements.count(); ++i)
- list << elements.at(i);
-
- std::list<QString> stdList = list.toStdList();
-
- QCOMPARE(int(stdList.size()), elements.size());
-
- std::list<QString>::const_iterator it = stdList.begin();
- QLinkedList<QString>::const_iterator it2 = list.cbegin();
- for (uint j = 0; j < stdList.size(); ++j, ++it, ++it2)
- QCOMPARE(*it, *it2);
-
- QCOMPARE(QLinkedList<QString>::fromStdList(stdList), list);
-}
-
void tst_Collections::list_stl_data()
{
QTest::addColumn<QStringList>("elements");
@@ -3038,15 +2772,6 @@ void tst_Collections::containerInstantiation()
typedef QSet<EqualsComparable> Set;
instantiateAssociative<Set, EqualsComparable>();
- //Instantiate QLinkedList member functions.
- typedef QLinkedList<EqualsComparable> LinkedList;
- instantiateSequence<LinkedList, EqualsComparable> ();
- {
- EqualsComparable value;
- LinkedList list;
- list.removeAll(value);
- }
-
//Instantiate QList member functions.
typedef QList<EqualsComparable> List;
instantiateRandomAccess<List, EqualsComparable>();
@@ -3153,7 +2878,6 @@ void tst_Collections::containerTypedefs()
testContainerTypedefs(QVector<int>());
testContainerTypedefs(QStack<int>());
testContainerTypedefs(QList<int>());
- testContainerTypedefs(QLinkedList<int>());
testContainerTypedefs(QQueue<int>());
testPairAssociativeContainerTypedefs(QMap<int, int>());
@@ -3175,7 +2899,6 @@ void tst_Collections::forwardDeclared()
{ typedef QMultiMap<Key1, T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
{ typedef QPair<T1, T2> C; C *x = 0; Q_UNUSED(x) }
{ typedef QList<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
- { typedef QLinkedList<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
{ typedef QVector<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) Q_UNUSED(i) Q_UNUSED(j) }
{ typedef QStack<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) Q_UNUSED(i) Q_UNUSED(j) }
{ typedef QQueue<T1> C; C *x = 0; C::iterator i; C::const_iterator j; Q_UNUSED(x) }
@@ -3400,7 +3123,6 @@ void tst_Collections::QTBUG13079_collectionInsideCollection()
QTBUG13079_collectionInsideCollectionImpl<QVector>();
QTBUG13079_collectionInsideCollectionImpl<QStack>();
QTBUG13079_collectionInsideCollectionImpl<QList>();
- QTBUG13079_collectionInsideCollectionImpl<QLinkedList>();
QTBUG13079_collectionInsideCollectionImpl<QQueue>();
{
diff --git a/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro b/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro
index efdb7fc2df..c114014bf4 100644
--- a/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro
+++ b/tests/auto/corelib/tools/containerapisymmetry/containerapisymmetry.pro
@@ -2,5 +2,3 @@ CONFIG += testcase
TARGET = tst_containerapisymmetry
SOURCES += tst_containerapisymmetry.cpp
QT = core testlib
-
-DEFINES -= QT_NO_LINKED_LIST
diff --git a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
index 0e4517e740..fe6e82e19c 100644
--- a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
+++ b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp
@@ -29,7 +29,6 @@
#include <QtTest/QtTest>
#include "qbytearray.h"
-#include "qlinkedlist.h"
#include "qlist.h"
#include "qstring.h"
#include "qvarlengtharray.h"
@@ -324,11 +323,6 @@ private Q_SLOTS:
#endif
}
- void ranged_ctor_QLinkedList_int() { ranged_ctor_non_associative_impl<QLinkedList<int>>(); }
- void ranged_ctor_QLinkedList_Movable() { ranged_ctor_non_associative_impl<QLinkedList<Movable>>(); }
- void ranged_ctor_QLinkedList_Complex() { ranged_ctor_non_associative_impl<QLinkedList<Complex>>(); }
- void ranged_ctor_QLinkedList_duplicates_strategy() { non_associative_container_duplicates_strategy<QLinkedList>(); }
-
void ranged_ctor_std_set_int() { ranged_ctor_non_associative_impl<std::set<int>>(); }
void ranged_ctor_std_set_Movable() { ranged_ctor_non_associative_impl<std::set<Movable>>(); }
void ranged_ctor_std_set_Complex() { ranged_ctor_non_associative_impl<std::set<Complex>>(); }
@@ -482,7 +476,6 @@ private Q_SLOTS:
void front_back_std_vector() { front_back_impl<std::vector<int>>(); }
void front_back_QVector() { front_back_impl<QVector<int>>(); }
void front_back_QList() { front_back_impl<QList<qintptr>>(); }
- void front_back_QLinkedList() { front_back_impl<QLinkedList<int>>(); }
void front_back_QVarLengthArray() { front_back_impl<QVarLengthArray<int>>(); }
void front_back_QString() { front_back_impl<QString>(); }
void front_back_QStringRef() { front_back_impl<QStringRef>(); }
@@ -587,9 +580,6 @@ template<typename ... T>
struct ContainerDuplicatedValuesStrategy<std::forward_list<T...>> : ContainerAcceptsDuplicateValues {};
#endif
-template<typename ... T>
-struct ContainerDuplicatedValuesStrategy<QLinkedList<T...>> : ContainerAcceptsDuplicateValues {};
-
// assuming https://cplusplus.github.io/LWG/lwg-active.html#2844 resolution
template<typename ... T>
struct ContainerDuplicatedValuesStrategy<std::set<T...>> : ContainerRejectsDuplicateValues {};
diff --git a/tests/auto/corelib/tools/qlinkedlist/.prev_CMakeLists.txt b/tests/auto/corelib/tools/qlinkedlist/.prev_CMakeLists.txt
deleted file mode 100644
index 7124e17d17..0000000000
--- a/tests/auto/corelib/tools/qlinkedlist/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-# Generated from qlinkedlist.pro.
-
-#####################################################################
-## tst_qlinkedlist Test:
-#####################################################################
-
-add_qt_test(tst_qlinkedlist
- SOURCES
- tst_qlinkedlist.cpp
- DEFINES
- -QT_NO_LINKED_LIST
-)
-
-## Scopes:
-#####################################################################
diff --git a/tests/auto/corelib/tools/qlinkedlist/CMakeLists.txt b/tests/auto/corelib/tools/qlinkedlist/CMakeLists.txt
deleted file mode 100644
index 2042739fa0..0000000000
--- a/tests/auto/corelib/tools/qlinkedlist/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-# Generated from qlinkedlist.pro.
-
-#####################################################################
-## tst_qlinkedlist Test:
-#####################################################################
-
-add_qt_test(tst_qlinkedlist
- SOURCES
- tst_qlinkedlist.cpp
- #DEFINES # special case remove
- #-QT_NO_LINKED_LIST # special case remove until fixed
-)
-
-## Scopes:
-#####################################################################
diff --git a/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro b/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro
deleted file mode 100644
index c53d553d6d..0000000000
--- a/tests/auto/corelib/tools/qlinkedlist/qlinkedlist.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qlinkedlist
-QT = core testlib
-qtConfig(c++14): CONFIG += c++14
-qtConfig(c++1z): CONFIG += c++1z
-SOURCES = tst_qlinkedlist.cpp
-DEFINES -= QT_NO_LINKED_LIST
diff --git a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp b/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
deleted file mode 100644
index ed0abff456..0000000000
--- a/tests/auto/corelib/tools/qlinkedlist/tst_qlinkedlist.cpp
+++ /dev/null
@@ -1,1072 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QLinkedList>
-
-struct Movable
-{
- Movable(char input = 'j') : i(input), state(Constructed)
- {
- ++liveCount;
- }
- Movable(const Movable &other)
- : i(other.i)
- , state(Constructed)
- {
- check(other.state, Constructed);
- ++liveCount;
- }
-
- ~Movable()
- {
- check(state, Constructed);
- i = 0;
- --liveCount;
- state = Destructed;
- }
-
- bool operator ==(const Movable &other) const
- {
- check(state, Constructed);
- check(other.state, Constructed);
- return i == other.i;
- }
-
- Movable &operator=(const Movable &other)
- {
- check(state, Constructed);
- check(other.state, Constructed);
- i = other.i;
- return *this;
- }
- char i;
-
- static int getLiveCount() { return liveCount; }
-private:
- static int liveCount;
-
- enum State { Constructed = 106, Destructed = 110 };
- State state;
-
- static void check(const State state1, const State state2)
- {
- QCOMPARE(int(state1), int(state2));
- }
-};
-
-int Movable::liveCount = 0;
-
-QT_BEGIN_NAMESPACE
-Q_DECLARE_TYPEINFO(Movable, Q_MOVABLE_TYPE);
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Movable);
-
-Q_DECLARE_METATYPE(QLinkedList<int>);
-
-
-int qHash(const Movable& movable)
-{
- return qHash(movable.i);
-}
-
-struct Complex
-{
- Complex(int val = 0)
- : value(val)
- , checkSum(this)
- {
- ++liveCount;
- }
-
- Complex(Complex const &other)
- : value(other.value)
- , checkSum(this)
- {
- ++liveCount;
- }
-
- Complex &operator=(Complex const &other)
- {
- check(); other.check();
-
- value = other.value;
- return *this;
- }
-
- ~Complex()
- {
- --liveCount;
- check();
- }
-
- operator int() const { return value; }
-
- bool operator==(Complex const &other) const
- {
- check(); other.check();
- return value == other.value;
- }
-
- void check() const
- {
- QVERIFY(this == checkSum);
- }
-
- static int getLiveCount() { return liveCount; }
-private:
- static int liveCount;
-
- int value;
- void *checkSum;
-};
-
-int Complex::liveCount = 0;
-
-Q_DECLARE_METATYPE(Complex);
-
-// Tests depend on the fact that:
-Q_STATIC_ASSERT(!QTypeInfo<int>::isStatic);
-Q_STATIC_ASSERT(!QTypeInfo<int>::isComplex);
-Q_STATIC_ASSERT(!QTypeInfo<Movable>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Movable>::isComplex);
-Q_STATIC_ASSERT(QTypeInfo<Complex>::isStatic);
-Q_STATIC_ASSERT(QTypeInfo<Complex>::isComplex);
-
-class tst_QLinkedList : public QObject
-{
- Q_OBJECT
-private slots:
- void eraseValidIteratorsOnSharedList() const;
- void insertWithIteratorsOnSharedList() const;
- void lengthInt() const;
- void lengthMovable() const;
- void lengthComplex() const;
- void lengthSignature() const;
- void firstInt() const;
- void firstMovable() const;
- void firstComplex() const;
- void lastInt() const;
- void lastMovable() const;
- void lastComplex() const;
- void beginInt() const;
- void beginMovable() const;
- void beginComplex() const;
- void endInt() const;
- void endMovable() const;
- void endComplex() const;
- void containsInt() const;
- void containsMovable() const;
- void containsComplex() const;
- void countInt() const;
- void countMovable() const;
- void countComplex() const;
- void cpp17ctad() const;
- void emptyInt() const;
- void emptyMovable() const;
- void emptyComplex() const;
- void endsWithInt() const;
- void endsWithMovable() const;
- void endsWithComplex() const;
- void removeAllInt() const;
- void removeAllMovable() const;
- void removeAllComplex() const;
- void removeOneInt() const;
- void removeOneMovable() const;
- void removeOneComplex() const;
- void reverseIterators() const;
- void startsWithInt() const;
- void startsWithMovable() const;
- void startsWithComplex() const;
- void takeFirstInt() const;
- void takeFirstMovable() const;
- void takeFirstComplex() const;
- void takeLastInt() const;
- void takeLastMovable() const;
- void takeLastComplex() const;
- void toStdListInt() const;
- void toStdListMovable() const;
- void toStdListComplex() const;
- void testOperatorsInt() const;
- void testOperatorsMovable() const;
- void testOperatorsComplex() const;
- void testSTLIteratorsInt() const;
- void testSTLIteratorsMovable() const;
- void testSTLIteratorsComplex() const;
-
- void initializeList() const;
-
- void constSharedNullInt() const;
- void constSharedNullMovable() const;
- void constSharedNullComplex() const;
-private:
- template<typename T> void length() const;
- template<typename T> void first() const;
- template<typename T> void last() const;
- template<typename T> void begin() const;
- template<typename T> void end() const;
- template<typename T> void contains() const;
- template<typename T> void count() const;
- template<typename T> void empty() const;
- template<typename T> void endsWith() const;
- template<typename T> void move() const;
- template<typename T> void removeAll() const;
- template<typename T> void removeOne() const;
- template<typename T> void startsWith() const;
- template<typename T> void swap() const;
- template<typename T> void takeFirst() const;
- template<typename T> void takeLast() const;
- template<typename T> void toStdList() const;
- template<typename T> void value() const;
-
- template<typename T> void testOperators() const;
- template<typename T> void testSTLIterators() const;
-
- template<typename T> void constSharedNull() const;
-
- int dummyForGuard;
-};
-
-template<typename T> struct SimpleValue
-{
- static T at(int index)
- {
- return values[index % maxSize];
- }
- static const uint maxSize = 7;
- static const T values[maxSize];
-};
-
-template<>
-const int SimpleValue<int>::values[] = { 10, 20, 30, 40, 100, 101, 102 };
-template<>
-const Movable SimpleValue<Movable>::values[] = { 10, 20, 30, 40, 100, 101, 102 };
-template<>
-const Complex SimpleValue<Complex>::values[] = { 10, 20, 30, 40, 100, 101, 102 };
-
-// Make some macros for the tests to use in order to be slightly more readable...
-#define T_FOO SimpleValue<T>::at(0)
-#define T_BAR SimpleValue<T>::at(1)
-#define T_BAZ SimpleValue<T>::at(2)
-#define T_CAT SimpleValue<T>::at(3)
-#define T_DOG SimpleValue<T>::at(4)
-#define T_BLAH SimpleValue<T>::at(5)
-#define T_WEEE SimpleValue<T>::at(6)
-
-template<typename T>
-void tst_QLinkedList::length() const
-{
- /* Empty list. */
- {
- const QLinkedList<T> list;
- QCOMPARE(list.size(), 0);
- }
-
- /* One entry. */
- {
- QLinkedList<T> list;
- list.append(T_FOO);
- QCOMPARE(list.size(), 1);
- }
-
- /* Two entries. */
- {
- QLinkedList<T> list;
- list.append(T_FOO);
- list.append(T_BAR);
- QCOMPARE(list.size(), 2);
- }
-
- /* Three entries. */
- {
- QLinkedList<T> list;
- list.append(T_FOO);
- list.append(T_BAR);
- list.append(T_BAZ);
- QCOMPARE(list.size(), 3);
- }
-}
-
-void tst_QLinkedList::eraseValidIteratorsOnSharedList() const
-{
- QLinkedList<int> a, b;
- a.append(5);
- a.append(10);
- a.append(20);
- a.append(20);
- a.append(20);
- a.append(20);
- a.append(30);
-
- QLinkedList<int>::iterator i = a.begin();
- ++i;
- ++i;
- ++i;
- b = a;
- QLinkedList<int>::iterator r = a.erase(i);
- QCOMPARE(b.size(), 7);
- QCOMPARE(a.size(), 6);
- --r;
- --r;
- QCOMPARE(*r, 10); // Ensure that number 2 instance was removed;
-}
-
-void tst_QLinkedList::insertWithIteratorsOnSharedList() const
-{
- QLinkedList<int> a, b;
- a.append(5);
- a.append(10);
- a.append(20);
- QLinkedList<int>::iterator i = a.begin();
- ++i;
- ++i;
- b = a;
-
- QLinkedList<int>::iterator i2 = a.insert(i, 15);
- QCOMPARE(b.size(), 3);
- QCOMPARE(a.size(), 4);
- --i2;
- QCOMPARE(*i2, 10);
-}
-
-void tst_QLinkedList::lengthInt() const
-{
- length<int>();
-}
-
-void tst_QLinkedList::lengthMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- length<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::lengthComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- length<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QLinkedList::lengthSignature() const
-{
- /* Constness. */
- {
- const QLinkedList<int> list;
- /* The function should be const. */
- list.size();
- }
-}
-
-template<typename T>
-void tst_QLinkedList::first() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(list.first(), T_FOO);
-
- // remove an item, make sure it still works
- list.pop_front();
- QVERIFY(list.size() == 1);
- QCOMPARE(list.first(), T_BAR);
-}
-
-void tst_QLinkedList::firstInt() const
-{
- first<int>();
-}
-
-void tst_QLinkedList::firstMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- first<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::firstComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- first<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::last() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(list.last(), T_BAR);
-
- // remove an item, make sure it still works
- list.pop_back();
- QVERIFY(list.size() == 1);
- QCOMPARE(list.last(), T_FOO);
-}
-
-void tst_QLinkedList::lastInt() const
-{
- last<int>();
-}
-
-void tst_QLinkedList::lastMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- last<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::lastComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- last<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::begin() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(*list.begin(), T_FOO);
-
- // remove an item, make sure it still works
- list.pop_front();
- QVERIFY(list.size() == 1);
- QCOMPARE(*list.begin(), T_BAR);
-}
-
-void tst_QLinkedList::beginInt() const
-{
- begin<int>();
-}
-
-void tst_QLinkedList::beginMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- begin<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::beginComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- begin<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::end() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR;
-
- QCOMPARE(*--list.end(), T_BAR);
-
- // remove an item, make sure it still works
- list.pop_back();
- QVERIFY(list.size() == 1);
- QCOMPARE(*--list.end(), T_FOO);
-}
-
-void tst_QLinkedList::endInt() const
-{
- end<int>();
-}
-
-void tst_QLinkedList::endMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- end<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::endComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- end<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::contains() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QVERIFY(list.contains(T_FOO));
- QVERIFY(list.contains(T_BLAH) != true);
-
- // add it and make sure it matches
- list.append(T_BLAH);
- QVERIFY(list.contains(T_BLAH));
-}
-
-void tst_QLinkedList::containsInt() const
-{
- contains<int>();
-}
-
-void tst_QLinkedList::containsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- contains<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::containsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- contains<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::count() const
-{
- QLinkedList<T> list;
-
- // starts empty
- QVERIFY(list.count() == 0);
-
- // goes up
- list.append(T_FOO);
- QVERIFY(list.count() == 1);
-
- // and up
- list.append(T_BAR);
- QVERIFY(list.count() == 2);
-
- // and down
- list.pop_back();
- QVERIFY(list.count() == 1);
-
- // and empty. :)
- list.pop_back();
- QVERIFY(list.count() == 0);
-}
-
-void tst_QLinkedList::countInt() const
-{
- count<int>();
-}
-
-void tst_QLinkedList::countMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- count<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::countComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- count<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QLinkedList::cpp17ctad() const
-{
-#ifdef __cpp_deduction_guides
-#define QVERIFY_IS_LIST_OF(obj, Type) \
- QVERIFY2((std::is_same<decltype(obj), QLinkedList<Type>>::value), \
- QMetaType::typeName(qMetaTypeId<decltype(obj)::value_type>()))
-#define CHECK(Type, One, Two, Three) \
- do { \
- const Type v[] = {One, Two, Three}; \
- QLinkedList v1 = {One, Two, Three}; \
- QVERIFY_IS_LIST_OF(v1, Type); \
- QLinkedList v2(v1.begin(), v1.end()); \
- QVERIFY_IS_LIST_OF(v2, Type); \
- QLinkedList v3(std::begin(v), std::end(v)); \
- QVERIFY_IS_LIST_OF(v3, Type); \
- } while (false) \
- /*end*/
- CHECK(int, 1, 2, 3);
- CHECK(double, 1.0, 2.0, 3.0);
- CHECK(QString, QStringLiteral("one"), QStringLiteral("two"), QStringLiteral("three"));
-#undef QVERIFY_IS_LIST_OF
-#undef CHECK
-#else
- QSKIP("This test requires C++17 Constructor Template Argument Deduction support enabled in the compiler.");
-#endif
-}
-
-template<typename T>
-void tst_QLinkedList::empty() const
-{
- QLinkedList<T> list;
-
- // make sure it starts empty
- QVERIFY(list.empty());
-
- // and doesn't stay empty
- list.append(T_FOO);
- QVERIFY(!list.empty());
-
- // and goes back to being empty
- list.pop_back();
- QVERIFY(list.empty());
-}
-
-void tst_QLinkedList::emptyInt() const
-{
- empty<int>();
-}
-
-void tst_QLinkedList::emptyMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- empty<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::emptyComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- empty<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::endsWith() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // test it returns correctly in both cases
- QVERIFY(list.endsWith(T_BAZ));
- QVERIFY(!list.endsWith(T_BAR));
-
- // remove an item and make sure the end item changes
- list.pop_back();
- QVERIFY(list.endsWith(T_BAR));
-}
-
-void tst_QLinkedList::endsWithInt() const
-{
- endsWith<int>();
-}
-
-void tst_QLinkedList::endsWithMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- endsWith<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::endsWithComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- endsWith<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::removeAll() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // remove one instance
- list.removeAll(T_BAR);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAZ);
-
- // many instances
- list << T_FOO << T_BAR << T_BAZ << T_FOO << T_BAR << T_BAZ << T_FOO << T_BAR << T_BAZ;
- list.removeAll(T_BAR);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ);
-
- // try remove something that doesn't exist
- list.removeAll(T_WEEE);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ << T_FOO << T_BAZ);
-}
-
-void tst_QLinkedList::removeAllInt() const
-{
- removeAll<int>();
-}
-
-void tst_QLinkedList::removeAllMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- removeAll<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::removeAllComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- removeAll<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::removeOne() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // middle
- list.removeOne(T_BAR);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAZ);
-
- // start
- list.removeOne(T_FOO);
- QCOMPARE(list, QLinkedList<T>() << T_BAZ);
-
- // last
- list.removeOne(T_BAZ);
- QCOMPARE(list, QLinkedList<T>());
-
- // make sure it really only removes one :)
- list << T_FOO << T_FOO;
- list.removeOne(T_FOO);
- QCOMPARE(list, QLinkedList<T>() << T_FOO);
-
- // try remove something that doesn't exist
- list.removeOne(T_WEEE);
- QCOMPARE(list, QLinkedList<T>() << T_FOO);
-}
-
-void tst_QLinkedList::removeOneInt() const
-{
- removeOne<int>();
-}
-
-void tst_QLinkedList::removeOneMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- removeOne<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::removeOneComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- removeOne<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QLinkedList::reverseIterators() const
-{
- QLinkedList<int> l;
- l << 1 << 2 << 3 << 4;
- QLinkedList<int> lr = l;
- std::reverse(lr.begin(), lr.end());
- const QLinkedList<int> &clr = lr;
- QVERIFY(std::equal(l.begin(), l.end(), lr.rbegin()));
- QVERIFY(std::equal(l.begin(), l.end(), lr.crbegin()));
- QVERIFY(std::equal(l.begin(), l.end(), clr.rbegin()));
- QVERIFY(std::equal(lr.rbegin(), lr.rend(), l.begin()));
- QVERIFY(std::equal(lr.crbegin(), lr.crend(), l.begin()));
- QVERIFY(std::equal(clr.rbegin(), clr.rend(), l.begin()));
-}
-
-template<typename T>
-void tst_QLinkedList::startsWith() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // make sure it starts ok
- QVERIFY(list.startsWith(T_FOO));
-
- // remove an item
- list.removeFirst();
- QVERIFY(list.startsWith(T_BAR));
-}
-
-void tst_QLinkedList::startsWithInt() const
-{
- startsWith<int>();
-}
-
-void tst_QLinkedList::startsWithMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- startsWith<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::startsWithComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- startsWith<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::takeFirst() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QCOMPARE(list.takeFirst(), T_FOO);
- QVERIFY(list.size() == 2);
- QCOMPARE(list.takeFirst(), T_BAR);
- QVERIFY(list.size() == 1);
- QCOMPARE(list.takeFirst(), T_BAZ);
- QVERIFY(list.size() == 0);
-}
-
-void tst_QLinkedList::takeFirstInt() const
-{
- takeFirst<int>();
-}
-
-void tst_QLinkedList::takeFirstMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- takeFirst<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::takeFirstComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- takeFirst<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::takeLast() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QCOMPARE(list.takeLast(), T_BAZ);
- QCOMPARE(list.takeLast(), T_BAR);
- QCOMPARE(list.takeLast(), T_FOO);
-}
-
-void tst_QLinkedList::takeLastInt() const
-{
- takeLast<int>();
-}
-
-void tst_QLinkedList::takeLastMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- takeLast<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::takeLastComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- takeLast<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::toStdList() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- // yuck.
- std::list<T> slist;
- slist.push_back(T_FOO);
- slist.push_back(T_BAR);
- slist.push_back(T_BAZ);
-
- QCOMPARE(list.toStdList(), slist);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAR << T_BAZ);
-}
-
-void tst_QLinkedList::toStdListInt() const
-{
- toStdList<int>();
-}
-
-void tst_QLinkedList::toStdListMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- toStdList<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::toStdListComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- toStdList<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::testOperators() const
-{
- QLinkedList<T> list;
- list << T_FOO << T_BAR << T_BAZ;
-
- QLinkedList<T> listtwo;
- listtwo << T_FOO << T_BAR << T_BAZ;
-
- // test equal
- QVERIFY(list == listtwo);
-
- // not equal
- listtwo.append(T_CAT);
- QVERIFY(list != listtwo);
-
- // +=
- list += listtwo;
- QVERIFY(list.size() == 7);
- QVERIFY(listtwo.size() == 4);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAR << T_BAZ
- << T_FOO << T_BAR << T_BAZ << T_CAT);
-
- // =
- list = listtwo;
- QCOMPARE(list, listtwo);
- QCOMPARE(list, QLinkedList<T>() << T_FOO << T_BAR << T_BAZ << T_CAT);
-}
-
-void tst_QLinkedList::testOperatorsInt() const
-{
- testOperators<int>();
-}
-
-void tst_QLinkedList::testOperatorsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- testOperators<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::testOperatorsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- testOperators<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-template<typename T>
-void tst_QLinkedList::testSTLIterators() const
-{
- QLinkedList<T> list;
-
- // create a list
- list << T_FOO << T_BAR << T_BAZ;
- typename QLinkedList<T>::iterator it = list.begin();
- QCOMPARE(*it, T_FOO); it++;
- QCOMPARE(*it, T_BAR); it++;
- QCOMPARE(*it, T_BAZ); it++;
- QCOMPARE(it, list.end()); it--;
-
- // walk backwards
- QCOMPARE(*it, T_BAZ); it--;
- QCOMPARE(*it, T_BAR); it--;
- QCOMPARE(*it, T_FOO);
-
- // test erase
- it = list.erase(it);
- QVERIFY(list.size() == 2);
- QCOMPARE(*it, T_BAR);
-
- // test multiple erase
- it = list.erase(it, it + 2);
- QVERIFY(list.size() == 0);
- QCOMPARE(it, list.end());
-
- // insert again
- it = list.insert(it, T_FOO);
- QVERIFY(list.size() == 1);
- QCOMPARE(*it, T_FOO);
-
- // insert again
- it = list.insert(it, T_BAR);
- QVERIFY(list.size() == 2);
- QCOMPARE(*it++, T_BAR);
- QCOMPARE(*it, T_FOO);
-}
-
-void tst_QLinkedList::testSTLIteratorsInt() const
-{
- testSTLIterators<int>();
-}
-
-void tst_QLinkedList::testSTLIteratorsMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- testSTLIterators<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::testSTLIteratorsComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- testSTLIterators<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-void tst_QLinkedList::initializeList() const
-{
- QLinkedList<int> v1 { 2, 3, 4 };
- QCOMPARE(v1, QLinkedList<int>() << 2 << 3 << 4);
- QCOMPARE(v1, (QLinkedList<int> { 2, 3, 4}));
-
- QLinkedList<QLinkedList<int>> v2{ v1, { 1 }, QLinkedList<int>(), { 2, 3, 4 } };
- QLinkedList<QLinkedList<int>> v3;
- v3 << v1 << (QLinkedList<int>() << 1) << QLinkedList<int>() << v1;
- QCOMPARE(v3, v2);
-}
-
-
-template<typename T>
-void tst_QLinkedList::constSharedNull() const
-{
- QLinkedList<T> list2;
- QVERIFY(!list2.isDetached());
-}
-
-void tst_QLinkedList::constSharedNullInt() const
-{
- constSharedNull<int>();
-}
-
-void tst_QLinkedList::constSharedNullMovable() const
-{
- const int liveCount = Movable::getLiveCount();
- constSharedNull<Movable>();
- QCOMPARE(liveCount, Movable::getLiveCount());
-}
-
-void tst_QLinkedList::constSharedNullComplex() const
-{
- const int liveCount = Complex::getLiveCount();
- constSharedNull<Complex>();
- QCOMPARE(liveCount, Complex::getLiveCount());
-}
-
-QTEST_APPLESS_MAIN(tst_QLinkedList)
-#include "tst_qlinkedlist.moc"
diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro
index be195ea037..e51be90100 100644
--- a/tests/auto/corelib/tools/tools.pro
+++ b/tests/auto/corelib/tools/tools.pro
@@ -16,7 +16,6 @@ SUBDIRS=\
qhash \
qhashfunctions \
qline \
- qlinkedlist \
qmakearray \
qmap \
qmargins \