From 605bbe2011f99f4a9036cbd41cd5a05fd3108070 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Mon, 12 Oct 2020 11:55:40 +0200 Subject: [PATCH] Make QtConcurrent docs more readable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replaced 'auto' keyword in function signatures by the actual return type. - Fixed signatures to not include enable_if statements. Change-Id: I7292e8e506fd50d22974a86448fa4e85e8f08dfb Reviewed-by: Andrei Golubev Reviewed-by: Andreas Buhr Reviewed-by: MÃ¥rten Nordheim --- src/concurrent/qtconcurrentfilter.h | 44 +++++++++++++++- src/concurrent/qtconcurrentmap.cpp | 6 +-- src/concurrent/qtconcurrentmap.h | 81 ++++++++++++++++++++++++++++- 3 files changed, 125 insertions(+), 6 deletions(-) diff --git a/src/concurrent/qtconcurrentfilter.h b/src/concurrent/qtconcurrentfilter.h index 8a17487466e..0552b8c0e3a 100644 --- a/src/concurrent/qtconcurrentfilter.h +++ b/src/concurrent/qtconcurrentfilter.h @@ -98,9 +98,14 @@ QFuture filteredReduced(Sequence &&sequence, QThreadPool::globalInstance(), std::forward(sequence), keep, reduce, options); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif QFuture filteredReduced(QThreadPool *pool, Sequence &&sequence, KeepFunctor keep, @@ -114,9 +119,14 @@ QFuture filteredReduced(QThreadPool *pool, ResultType(std::forward(initialValue)), options); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif QFuture filteredReduced(Sequence &&sequence, KeepFunctor keep, ReduceFunctor reduce, @@ -214,9 +224,14 @@ QFuture filteredReduced(Iterator begin, options); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif QFuture filteredReduced(QThreadPool *pool, Iterator begin, Iterator end, @@ -230,9 +245,14 @@ QFuture filteredReduced(QThreadPool *pool, ResultType(std::forward(initialValue)), options); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif QFuture filteredReduced(Iterator begin, Iterator end, KeepFunctor keep, @@ -380,9 +400,14 @@ ResultType blockingFilteredReduced(Sequence &&sequence, return future.takeResult(); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif ResultType blockingFilteredReduced(QThreadPool *pool, Sequence &&sequence, KeepFunctor keep, @@ -397,9 +422,14 @@ ResultType blockingFilteredReduced(QThreadPool *pool, return future.takeResult(); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif ResultType blockingFilteredReduced(Sequence &&sequence, KeepFunctor keep, ReduceFunctor reduce, @@ -505,9 +535,14 @@ ResultType blockingFilteredReduced(Iterator begin, return future.takeResult(); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif ResultType blockingFilteredReduced(QThreadPool *pool, Iterator begin, Iterator end, @@ -522,9 +557,14 @@ ResultType blockingFilteredReduced(QThreadPool *pool, return future.takeResult(); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif ResultType blockingFilteredReduced(Iterator begin, Iterator end, KeepFunctor keep, @@ -605,7 +645,7 @@ ResultType blockingFilteredReduced(Iterator begin, // blocking filtered() on sequences template -auto blockingFiltered(QThreadPool *pool, Sequence &&sequence, KeepFunctor keep) +std::decay_t blockingFiltered(QThreadPool *pool, Sequence &&sequence, KeepFunctor keep) { return blockingFilteredReduced>( pool, std::forward(sequence), keep, QtPrivate::PushBackWrapper(), @@ -613,7 +653,7 @@ auto blockingFiltered(QThreadPool *pool, Sequence &&sequence, KeepFunctor keep) } template -auto blockingFiltered(Sequence &&sequence, KeepFunctor keep) +std::decay_t blockingFiltered(Sequence &&sequence, KeepFunctor keep) { return blockingFilteredReduced>( QThreadPool::globalInstance(), std::forward(sequence), keep, diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp index 43313feeef3..ec94975f386 100644 --- a/src/concurrent/qtconcurrentmap.cpp +++ b/src/concurrent/qtconcurrentmap.cpp @@ -588,7 +588,7 @@ Calls \a function once for each item in \a sequence and returns an OutputSequence containing the results. All calls to \a function are invoked from the threads taken from the QThreadPool - \a pool. The type of the results will match the type returned my the MapFunctor. + \a pool. The type of the results will match the type returned by the MapFunctor. \note This function will block until all items in the sequence have been processed. @@ -596,10 +596,10 @@ */ /*! - \fn template OutputSequence QtConcurrent::blockingMapped(const InputSequence &&sequence, MapFunctor function) + \fn template OutputSequence QtConcurrent::blockingMapped(InputSequence &&sequence, MapFunctor function) Calls \a function once for each item in \a sequence and returns an OutputSequence containing - the results. The type of the results will match the type returned my the MapFunctor. + the results. The type of the results will match the type returned by the MapFunctor. \note This function will block until all items in the sequence have been processed. diff --git a/src/concurrent/qtconcurrentmap.h b/src/concurrent/qtconcurrentmap.h index 2b475dced10..29ab364e77d 100644 --- a/src/concurrent/qtconcurrentmap.h +++ b/src/concurrent/qtconcurrentmap.h @@ -105,9 +105,14 @@ QFuture mappedReduced(Sequence &&sequence, (QThreadPool::globalInstance(), std::forward(sequence), map, reduce, options); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif QFuture mappedReduced(QThreadPool *pool, Sequence &&sequence, MapFunctor map, @@ -120,10 +125,14 @@ QFuture mappedReduced(QThreadPool *pool, pool, std::forward(sequence), map, reduce, ResultType(std::forward(initialValue)), options); } - +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif QFuture mappedReduced(Sequence &&sequence, MapFunctor map, ReduceFunctor reduce, @@ -162,10 +171,15 @@ QFuture mappedReduced( (QThreadPool::globalInstance(), std::forward(sequence), map, reduce, options); } +#ifdef Q_CLANG_QDOC +template +#else template ::ResultType, typename InitialValueType, std::enable_if_t, int> = 0> +#endif QFuture mappedReduced(QThreadPool *pool, Sequence &&sequence, MapFunctor map, @@ -179,10 +193,15 @@ QFuture mappedReduced(QThreadPool *pool, ResultType(std::forward(initialValue)), options); } +#ifdef Q_CLANG_QDOC +template +#else template ::ResultType, typename InitialValueType, std::enable_if_t, int> = 0> +#endif QFuture mappedReduced(Sequence &&sequence, MapFunctor map, ReduceFunctor reduce, @@ -221,9 +240,14 @@ QFuture mappedReduced(Iterator begin, (QThreadPool::globalInstance(), begin, end, map, reduce, options); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif QFuture mappedReduced(QThreadPool *pool, Iterator begin, Iterator end, @@ -238,9 +262,14 @@ QFuture mappedReduced(QThreadPool *pool, ResultType(std::forward(initialValue)), options); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif QFuture mappedReduced(Iterator begin, Iterator end, MapFunctor map, @@ -281,10 +310,15 @@ QFuture mappedReduced(Iterator begin, (QThreadPool::globalInstance(), begin, end, map, reduce, options); } +#ifdef Q_CLANG_QDOC +template +#else template ::ResultType, typename InitialValueType, std::enable_if_t, int> = 0> +#endif QFuture mappedReduced(QThreadPool *pool, Iterator begin, Iterator end, @@ -299,10 +333,15 @@ QFuture mappedReduced(QThreadPool *pool, options); } +#ifdef Q_CLANG_QDOC +template +#else template ::ResultType, typename InitialValueType, std::enable_if_t, int> = 0> +#endif QFuture mappedReduced(Iterator begin, Iterator end, MapFunctor map, @@ -415,9 +454,14 @@ ResultType blockingMappedReduced(Sequence &&sequence, return future.takeResult(); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif ResultType blockingMappedReduced(QThreadPool *pool, Sequence &&sequence, MapFunctor map, @@ -433,9 +477,14 @@ ResultType blockingMappedReduced(QThreadPool *pool, return future.takeResult(); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif ResultType blockingMappedReduced(Sequence &&sequence, MapFunctor map, ReduceFunctor reduce, @@ -479,10 +528,15 @@ ResultType blockingMappedReduced(Sequence &&sequence, return future.takeResult(); } +#ifdef Q_CLANG_QDOC +template +#else template ::ResultType, typename InitialValueType, std::enable_if_t, int> = 0> +#endif ResultType blockingMappedReduced(QThreadPool *pool, Sequence &&sequence, MapFunctor map, @@ -498,10 +552,15 @@ ResultType blockingMappedReduced(QThreadPool *pool, return future.takeResult(); } +#ifdef Q_CLANG_QDOC +template +#else template ::ResultType, typename InitialValueType, std::enable_if_t, int> = 0> +#endif ResultType blockingMappedReduced(Sequence &&sequence, MapFunctor map, ReduceFunctor reduce, @@ -546,9 +605,14 @@ ResultType blockingMappedReduced(Iterator begin, return future.takeResult(); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif ResultType blockingMappedReduced(QThreadPool *pool, Iterator begin, Iterator end, @@ -565,9 +629,14 @@ ResultType blockingMappedReduced(QThreadPool *pool, return future.takeResult(); } +#ifdef Q_CLANG_QDOC +template +#else template , int> = 0> +#endif ResultType blockingMappedReduced(Iterator begin, Iterator end, MapFunctor map, @@ -614,10 +683,15 @@ ResultType blockingMappedReduced(Iterator begin, return future.takeResult(); } +#ifdef Q_CLANG_QDOC +template +#else template ::ResultType, typename InitialValueType, std::enable_if_t, int> = 0> +#endif ResultType blockingMappedReduced(QThreadPool *pool, Iterator begin, Iterator end, @@ -634,10 +708,15 @@ ResultType blockingMappedReduced(QThreadPool *pool, return future.takeResult(); } +#ifdef Q_CLANG_QDOC +template +#else template ::ResultType, typename InitialValueType, std::enable_if_t, int> = 0> +#endif ResultType blockingMappedReduced(Iterator begin, Iterator end, MapFunctor map,