Remove QLinkedList

QLinkedList has been moved to Qt5Compat. Remove and stop mentioning
it in docs, examples (the docs & examples for QLinkedList itself will
be moved to Qt5Compat) and remove the corresponding tests.

Also remove QT_NO_LINKED_LIST, since it's not needed anymore.

Task-number: QTBUG-81630
Task-number: QTBUG-80312
Change-Id: I4a8f1105cb60aa87e7fd67e901ec1a27c489aa31
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Sona Kurazyan 2020-01-29 11:13:31 +01:00
parent 98543f0a13
commit 63a559845c
47 changed files with 43 additions and 5201 deletions

View File

@ -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

View File

@ -115,7 +115,7 @@
\li Supported
\row
\li Bidirectional Iterator
\li QLinkedList, std::list
\li std::list
\li Supported
\row
\li Random Access Iterator

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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()) {

View File

@ -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);
}

View File

@ -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]

View File

@ -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

View File

@ -66,7 +66,6 @@
\li QIcon
\li QImage
\li QKeySequence
\li QLinkedList<T>
\li QMap<Key, T>
\li QMargins
\li QMatrix4x4

View File

@ -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)
*/

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -200,55 +200,6 @@
\sa QMutableListIterator, QList::const_iterator
*/
/*!
\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
@ -414,68 +365,6 @@
\sa QListIterator, QList::iterator
*/
/*!
\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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -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 \

View File

@ -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:

View File

@ -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>

View File

@ -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)

View File

@ -41,7 +41,6 @@
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qapplication.h>
#include <QtCore/qlinkedlist.h>
#include <QtCore/qstack.h>
#ifdef QT_DEBUG

View File

@ -2,4 +2,3 @@ CONFIG += testcase
TARGET = tst_qtconcurrentfilter
QT = core testlib concurrent
SOURCES = tst_qtconcurrentfilter.cpp
DEFINES -= QT_NO_LINKED_LIST

View File

@ -28,7 +28,6 @@
#include <qtconcurrentfilter.h>
#include <QCoreApplication>
#include <QList>
#include <QLinkedList>
#include <QtTest/QtTest>
#include "../qtconcurrentmap/functions.h"
@ -62,18 +61,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);
}
{
QVector<int> vector;
vector << 1 << 2 << 3 << 4;
@ -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
}

View File

@ -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

View File

@ -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
}

View File

@ -27,7 +27,6 @@
****************************************************************************/
#include <QtTest>
#include <qlinkedlist.h>
#include <qobject.h>
#include <qrandom.h>
#include <qvector.h>

View File

@ -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".

View File

@ -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) \

View File

@ -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) {

View File

@ -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()

View File

@ -3,8 +3,6 @@ TARGET = tst_qdatastream
QT += testlib
SOURCES = tst_qdatastream.cpp
DEFINES -= QT_NO_LINKED_LIST
TESTDATA += datastream.q42
android:!android-embedded {

View File

@ -186,7 +186,7 @@ private slots:
void status_QHash_QMap();
void status_QLinkedList_QList_QVector();
void status_QList_QVector();
void streamToAndFromQByteArray();
@ -3171,24 +3171,6 @@ void tst_QDataStream::status_QHash_QMap()
QVERIFY(list.isEmpty()); \
} \
} \
{ \
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) \
@ -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;

View File

@ -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)

View File

@ -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

View File

@ -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;
@ -2310,12 +2081,6 @@ void populate(QList<int> &container)
container << 1 << 2 << 4 << 8;
}
template <>
void populate(QLinkedList<int> &container)
{
container << 1 << 2 << 4 << 8;
}
template <>
void populate(QMap<int, int> &container)
{
@ -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>();
{

View File

@ -2,5 +2,3 @@ CONFIG += testcase
TARGET = tst_containerapisymmetry
SOURCES += tst_containerapisymmetry.cpp
QT = core testlib
DEFINES -= QT_NO_LINKED_LIST

View File

@ -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 {};

View File

@ -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:
#####################################################################

View File

@ -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:
#####################################################################

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,6 @@ SUBDIRS=\
qhash \
qhashfunctions \
qline \
qlinkedlist \
qmakearray \
qmap \
qmargins \