Remove references to QT_NO_STL from QtConcurrent

Same as with QtCore, remove the #ifdef and #ifndef and select the side
with STL.

Change-Id: If1440080328c7c51afe35f5944a19dafc4761ee5
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
This commit is contained in:
Thiago Macieira 2012-03-26 15:29:34 -03:00 committed by Qt by Nokia
parent 6f51fee995
commit 9dde45722b
4 changed files with 1 additions and 48 deletions

View File

@ -50,9 +50,7 @@
#include <QtConcurrent/qtconcurrentmedian.h> #include <QtConcurrent/qtconcurrentmedian.h>
#include <QtConcurrent/qtconcurrentthreadengine.h> #include <QtConcurrent/qtconcurrentthreadengine.h>
#ifndef QT_NO_STL
#include <iterator> #include <iterator>
#endif
QT_BEGIN_HEADER QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -62,15 +60,7 @@ QT_BEGIN_NAMESPACE
namespace QtConcurrent { namespace QtConcurrent {
#ifndef QT_NO_STL
using std::advance; using std::advance;
#else
template <typename It, typename T>
void advance(It &it, T value)
{
it+=value;
}
#endif
/* /*
The BlockSizeManager class manages how many iterations a thread should The BlockSizeManager class manages how many iterations a thread should
@ -149,7 +139,6 @@ public:
inline void * getPointer() { return 0; } inline void * getPointer() { return 0; }
}; };
#ifndef QT_NO_STL
inline bool selectIteration(std::bidirectional_iterator_tag) inline bool selectIteration(std::bidirectional_iterator_tag)
{ {
return false; // while return false; // while
@ -164,14 +153,6 @@ inline bool selectIteration(std::random_access_iterator_tag)
{ {
return true; // for return true; // for
} }
#else
// no stl support, always use while iteration
template <typename T>
inline bool selectIteration(T)
{
return false; // while
}
#endif
template <typename Iterator, typename T> template <typename Iterator, typename T>
class IterateKernel : public ThreadEngine<T> class IterateKernel : public ThreadEngine<T>
@ -180,20 +161,10 @@ public:
typedef T ResultType; typedef T ResultType;
IterateKernel(Iterator _begin, Iterator _end) IterateKernel(Iterator _begin, Iterator _end)
#if defined (QT_NO_STL)
: begin(_begin), end(_end), current(_begin), currentIndex(0),
forIteration(false), progressReportingEnabled(true)
#else
: begin(_begin), end(_end), current(_begin), currentIndex(0), : begin(_begin), end(_end), current(_begin), currentIndex(0),
forIteration(selectIteration(typename std::iterator_traits<Iterator>::iterator_category())), progressReportingEnabled(true) forIteration(selectIteration(typename std::iterator_traits<Iterator>::iterator_category())), progressReportingEnabled(true)
#endif
{ {
#if defined (QT_NO_STL)
iterationCount = 0;
#else
iterationCount = forIteration ? std::distance(_begin, _end) : 0; iterationCount = forIteration ? std::distance(_begin, _end) : 0;
#endif
} }
virtual ~IterateKernel() { } virtual ~IterateKernel() { }

View File

@ -57,9 +57,7 @@ private slots:
void resultAt(); void resultAt();
void incrementalResults(); void incrementalResults();
void noDetach(); void noDetach();
#ifndef QT_NO_STL
void stlContainers(); void stlContainers();
#endif
}; };
void tst_QtConcurrentFilter::filter() void tst_QtConcurrentFilter::filter()
@ -1496,7 +1494,6 @@ void tst_QtConcurrentFilter::noDetach()
} }
} }
#ifndef QT_NO_STL
void tst_QtConcurrentFilter::stlContainers() void tst_QtConcurrentFilter::stlContainers()
{ {
std::vector<int> vector; std::vector<int> vector;
@ -1523,7 +1520,6 @@ void tst_QtConcurrentFilter::stlContainers()
QCOMPARE(list2.size(), (std::list<int>::size_type)(1)); QCOMPARE(list2.size(), (std::list<int>::size_type)(1));
QCOMPARE(*list2.begin(), 1); QCOMPARE(*list2.begin(), 1);
} }
#endif
QTEST_MAIN(tst_QtConcurrentFilter) QTEST_MAIN(tst_QtConcurrentFilter)
#include "tst_qtconcurrentfilter.moc" #include "tst_qtconcurrentfilter.moc"

View File

@ -65,7 +65,6 @@ struct TestIterator
}; };
#include <qiterator.h> #include <qiterator.h>
#ifndef QT_NO_STL
namespace std { namespace std {
template <> template <>
struct iterator_traits<TestIterator> struct iterator_traits<TestIterator>
@ -79,7 +78,6 @@ int distance(TestIterator &a, TestIterator &b)
} }
} }
#endif
#include <qtconcurrentiteratekernel.h> #include <qtconcurrentiteratekernel.h>
#include <QtTest/QtTest> #include <QtTest/QtTest>
@ -96,10 +94,8 @@ private slots:
void stresstest(); void stresstest();
void noIterations(); void noIterations();
void throttling(); void throttling();
#ifndef QT_NO_STL
void blockSize(); void blockSize();
void multipleResults(); void multipleResults();
#endif
}; };
QAtomicInt iterations; QAtomicInt iterations;
@ -268,8 +264,6 @@ public:
} }
}; };
// Missing stl iterators prevent correct block size calculation.
#ifndef QT_NO_STL
void tst_QtConcurrentIterateKernel::blockSize() void tst_QtConcurrentIterateKernel::blockSize()
{ {
const int expectedMinimumBlockSize = 1024 / QThread::idealThreadCount(); const int expectedMinimumBlockSize = 1024 / QThread::idealThreadCount();
@ -278,7 +272,6 @@ void tst_QtConcurrentIterateKernel::blockSize()
qDebug() << "block size" << peakBlockSize; qDebug() << "block size" << peakBlockSize;
QVERIFY(peakBlockSize >= expectedMinimumBlockSize); QVERIFY(peakBlockSize >= expectedMinimumBlockSize);
} }
#endif
class MultipleResultsFor : public IterateKernel<TestIterator, int> class MultipleResultsFor : public IterateKernel<TestIterator, int>
{ {
@ -292,8 +285,6 @@ public:
} }
}; };
// Missing stl iterators prevent correct summation.
#ifndef QT_NO_STL
void tst_QtConcurrentIterateKernel::multipleResults() void tst_QtConcurrentIterateKernel::multipleResults()
{ {
QFuture<int> f = startThreadEngine(new MultipleResultsFor(0, 10)).startAsynchronously(); QFuture<int> f = startThreadEngine(new MultipleResultsFor(0, 10)).startAsynchronously();
@ -303,7 +294,6 @@ void tst_QtConcurrentIterateKernel::multipleResults()
QCOMPARE(f.resultAt(9), 9); QCOMPARE(f.resultAt(9), 9);
f.waitForFinished(); f.waitForFinished();
} }
#endif
QTEST_MAIN(tst_QtConcurrentIterateKernel) QTEST_MAIN(tst_QtConcurrentIterateKernel)

View File

@ -72,9 +72,7 @@ private slots:
#endif #endif
void incrementalResults(); void incrementalResults();
void noDetach(); void noDetach();
#ifndef QT_NO_STL
void stlContainers(); void stlContainers();
#endif
void qFutureAssignmentLeak(); void qFutureAssignmentLeak();
void stressTest(); void stressTest();
public slots: public slots:
@ -2301,7 +2299,6 @@ void tst_QtConcurrentMap::noDetach()
} }
#ifndef QT_NO_STL
void tst_QtConcurrentMap::stlContainers() void tst_QtConcurrentMap::stlContainers()
{ {
std::vector<int> vector; std::vector<int> vector;
@ -2322,7 +2319,6 @@ void tst_QtConcurrentMap::stlContainers()
QtConcurrent::blockingMap(list, multiplyBy2Immutable); QtConcurrent::blockingMap(list, multiplyBy2Immutable);
} }
#endif
InstanceCounter ic_fn(const InstanceCounter & ic) InstanceCounter ic_fn(const InstanceCounter & ic)
{ {