diff --git a/src/concurrent/qtconcurrentiteratekernel.h b/src/concurrent/qtconcurrentiteratekernel.h index 2a7aba3911..6caae61816 100644 --- a/src/concurrent/qtconcurrentiteratekernel.h +++ b/src/concurrent/qtconcurrentiteratekernel.h @@ -155,13 +155,15 @@ inline bool selectIteration(std::random_access_iterator_tag) template class IterateKernel : public ThreadEngine { + using IteratorCategory = typename std::iterator_traits::iterator_category; + public: typedef T ResultType; IterateKernel(QThreadPool *pool, Iterator _begin, Iterator _end) - : ThreadEngine(pool), begin(_begin), end(_end), current(_begin), currentIndex(0) - , forIteration(selectIteration(typename std::iterator_traits::iterator_category())) - , iterationCount(forIteration ? std::distance(_begin, _end) : 0) + : ThreadEngine(pool), begin(_begin), end(_end), current(_begin) + , iterationCount(selectIteration(IteratorCategory()) ? std::distance(_begin, _end) : 0) + , forIteration(selectIteration(IteratorCategory())) , progressReportingEnabled(true) { } @@ -287,12 +289,11 @@ public: const Iterator end; Iterator current; QAtomicInt currentIndex; - const bool forIteration; QAtomicInt iteratorThreads; - const int iterationCount; - - bool progressReportingEnabled; QAtomicInt completed; + const int iterationCount; + const bool forIteration; + bool progressReportingEnabled; }; } // namespace QtConcurrent