diff options
Diffstat (limited to 'src/corelib/concurrent/qtconcurrentiteratekernel.h')
-rw-r--r-- | src/corelib/concurrent/qtconcurrentiteratekernel.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/corelib/concurrent/qtconcurrentiteratekernel.h b/src/corelib/concurrent/qtconcurrentiteratekernel.h index 120a328..51019a2 100644 --- a/src/corelib/concurrent/qtconcurrentiteratekernel.h +++ b/src/corelib/concurrent/qtconcurrentiteratekernel.h @@ -49,8 +49,10 @@ #include <QtCore/qatomic.h> #include <QtCore/qtconcurrentmedian.h> #include <QtCore/qtconcurrentthreadengine.h> -#include <iterator> +#ifndef QT_NO_STL +# include <iterator> +#endif QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -148,6 +150,7 @@ public: inline void * getPointer() { return 0; } }; +#ifndef QT_NO_STL inline bool selectIteration(std::bidirectional_iterator_tag) { return false; // while @@ -162,6 +165,14 @@ inline bool selectIteration(std::random_access_iterator_tag) { 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> class IterateKernel : public ThreadEngine<T> @@ -170,7 +181,10 @@ public: typedef T ResultType; IterateKernel(Iterator _begin, Iterator _end) -#ifndef QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION +#if defined (QT_NO_STL) + : begin(_begin), end(_end), current(_begin), currentIndex(0), + forIteration(false), progressReportingEnabled(true) +#elif !defined(QT_NO_PARTIAL_TEMPLATE_SPECIALIZATION) : begin(_begin), end(_end), current(_begin), currentIndex(0), forIteration(selectIteration(typename std::iterator_traits<Iterator>::iterator_category())), progressReportingEnabled(true) #else @@ -178,7 +192,12 @@ public: forIteration(selectIteration(std::iterator_category(_begin))), progressReportingEnabled(true) #endif { +#if defined (QT_NO_STL) + iterationCount = 0; +#else iterationCount = forIteration ? std::distance(_begin, _end) : 0; + +#endif } virtual ~IterateKernel() { } |