From 7b1bbdb10ca1d89c9d6603e1e4baf9435a2e6ce5 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Mon, 9 Nov 2020 15:53:53 +0100 Subject: Reorder IterateKernel data members to avoid holes in the data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7661eaa6b14b7a7b930390e6bb8c6894f4a91846 Reviewed-by: MÃ¥rten Nordheim --- src/concurrent/qtconcurrentiteratekernel.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/concurrent') diff --git a/src/concurrent/qtconcurrentiteratekernel.h b/src/concurrent/qtconcurrentiteratekernel.h index 2a7aba39119..6caae618163 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; + QAtomicInt completed; const int iterationCount; - + const bool forIteration; bool progressReportingEnabled; - QAtomicInt completed; }; } // namespace QtConcurrent -- cgit v1.2.3