diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-11-09 15:53:53 +0100 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-11-09 16:41:26 +0100 |
commit | 7b1bbdb10ca1d89c9d6603e1e4baf9435a2e6ce5 (patch) | |
tree | 436e97bfd0ac2199d7bb228c7168dbab7442143b | |
parent | 8186f18c4a815a2ec6ca534a01b5549a62e7fdb7 (diff) |
Reorder IterateKernel data members to avoid holes in the data
Change-Id: I7661eaa6b14b7a7b930390e6bb8c6894f4a91846
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
-rw-r--r-- | src/concurrent/qtconcurrentiteratekernel.h | 13 |
1 files changed, 7 insertions, 6 deletions
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 <typename Iterator, typename T> class IterateKernel : public ThreadEngine<T> { + using IteratorCategory = typename std::iterator_traits<Iterator>::iterator_category; + public: typedef T ResultType; IterateKernel(QThreadPool *pool, Iterator _begin, Iterator _end) - : ThreadEngine<T>(pool), begin(_begin), end(_end), current(_begin), currentIndex(0) - , forIteration(selectIteration(typename std::iterator_traits<Iterator>::iterator_category())) - , iterationCount(forIteration ? std::distance(_begin, _end) : 0) + : ThreadEngine<T>(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; + QAtomicInt completed; const int iterationCount; - + const bool forIteration; bool progressReportingEnabled; - QAtomicInt completed; }; } // namespace QtConcurrent |