Make QtConcurrent docs more readable

- 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 <andrei.golubev@qt.io>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Sona Kurazyan 2020-10-12 11:55:40 +02:00
parent 3069313492
commit 605bbe2011
3 changed files with 125 additions and 6 deletions

View File

@ -98,9 +98,14 @@ QFuture<ResultType> filteredReduced(Sequence &&sequence,
QThreadPool::globalInstance(), std::forward<Sequence>(sequence), keep, reduce, options);
}
#ifdef Q_CLANG_QDOC
template <typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> filteredReduced(QThreadPool *pool,
Sequence &&sequence,
KeepFunctor keep,
@ -114,9 +119,14 @@ QFuture<ResultType> filteredReduced(QThreadPool *pool,
ResultType(std::forward<InitialValueType>(initialValue)), options);
}
#ifdef Q_CLANG_QDOC
template <typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> filteredReduced(Sequence &&sequence,
KeepFunctor keep,
ReduceFunctor reduce,
@ -214,9 +224,14 @@ QFuture<ResultType> filteredReduced(Iterator begin,
options);
}
#ifdef Q_CLANG_QDOC
template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> filteredReduced(QThreadPool *pool,
Iterator begin,
Iterator end,
@ -230,9 +245,14 @@ QFuture<ResultType> filteredReduced(QThreadPool *pool,
ResultType(std::forward<InitialValueType>(initialValue)), options);
}
#ifdef Q_CLANG_QDOC
template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> filteredReduced(Iterator begin,
Iterator end,
KeepFunctor keep,
@ -380,9 +400,14 @@ ResultType blockingFilteredReduced(Sequence &&sequence,
return future.takeResult();
}
#ifdef Q_CLANG_QDOC
template <typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, 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 <typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, 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 <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, 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 <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
ResultType blockingFilteredReduced(Iterator begin,
Iterator end,
KeepFunctor keep,
@ -605,7 +645,7 @@ ResultType blockingFilteredReduced(Iterator begin,
// blocking filtered() on sequences
template <typename Sequence, typename KeepFunctor>
auto blockingFiltered(QThreadPool *pool, Sequence &&sequence, KeepFunctor keep)
std::decay_t<Sequence> blockingFiltered(QThreadPool *pool, Sequence &&sequence, KeepFunctor keep)
{
return blockingFilteredReduced<std::decay_t<Sequence>>(
pool, std::forward<Sequence>(sequence), keep, QtPrivate::PushBackWrapper(),
@ -613,7 +653,7 @@ auto blockingFiltered(QThreadPool *pool, Sequence &&sequence, KeepFunctor keep)
}
template <typename Sequence, typename KeepFunctor>
auto blockingFiltered(Sequence &&sequence, KeepFunctor keep)
std::decay_t<Sequence> blockingFiltered(Sequence &&sequence, KeepFunctor keep)
{
return blockingFilteredReduced<std::decay_t<Sequence>>(
QThreadPool::globalInstance(), std::forward<Sequence>(sequence), keep,

View File

@ -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 <typename OutputSequence, typename InputSequence, typename MapFunctor> OutputSequence QtConcurrent::blockingMapped(const InputSequence &&sequence, MapFunctor function)
\fn template <typename OutputSequence, typename InputSequence, typename MapFunctor> 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.

View File

@ -105,9 +105,14 @@ QFuture<ResultType> mappedReduced(Sequence &&sequence,
(QThreadPool::globalInstance(), std::forward<Sequence>(sequence), map, reduce, options);
}
#ifdef Q_CLANG_QDOC
template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> mappedReduced(QThreadPool *pool,
Sequence &&sequence,
MapFunctor map,
@ -120,10 +125,14 @@ QFuture<ResultType> mappedReduced(QThreadPool *pool,
pool, std::forward<Sequence>(sequence), map, reduce,
ResultType(std::forward<InitialValueType>(initialValue)), options);
}
#ifdef Q_CLANG_QDOC
template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> mappedReduced(Sequence &&sequence,
MapFunctor map,
ReduceFunctor reduce,
@ -162,10 +171,15 @@ QFuture<ResultType> mappedReduced(
(QThreadPool::globalInstance(), std::forward<Sequence>(sequence), map, reduce, options);
}
#ifdef Q_CLANG_QDOC
template <typename Sequence, typename MapFunctor, typename ReduceFunctor, typename ResultType,
typename InitialValueType>
#else
template <typename Sequence, typename MapFunctor, typename ReduceFunctor,
typename ResultType = typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> mappedReduced(QThreadPool *pool,
Sequence &&sequence,
MapFunctor map,
@ -179,10 +193,15 @@ QFuture<ResultType> mappedReduced(QThreadPool *pool,
ResultType(std::forward<InitialValueType>(initialValue)), options);
}
#ifdef Q_CLANG_QDOC
template <typename Sequence, typename MapFunctor, typename ReduceFunctor, typename ResultType,
typename InitialValueType>
#else
template <typename Sequence, typename MapFunctor, typename ReduceFunctor,
typename ResultType = typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> mappedReduced(Sequence &&sequence,
MapFunctor map,
ReduceFunctor reduce,
@ -221,9 +240,14 @@ QFuture<ResultType> mappedReduced(Iterator begin,
(QThreadPool::globalInstance(), begin, end, map, reduce, options);
}
#ifdef Q_CLANG_QDOC
template <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> mappedReduced(QThreadPool *pool,
Iterator begin,
Iterator end,
@ -238,9 +262,14 @@ QFuture<ResultType> mappedReduced(QThreadPool *pool,
ResultType(std::forward<InitialValueType>(initialValue)), options);
}
#ifdef Q_CLANG_QDOC
template <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> mappedReduced(Iterator begin,
Iterator end,
MapFunctor map,
@ -281,10 +310,15 @@ QFuture<ResultType> mappedReduced(Iterator begin,
(QThreadPool::globalInstance(), begin, end, map, reduce, options);
}
#ifdef Q_CLANG_QDOC
template <typename Iterator, typename MapFunctor, typename ReduceFunctor, typename ResultType,
typename InitialValueType>
#else
template <typename Iterator, typename MapFunctor, typename ReduceFunctor,
typename ResultType = typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> mappedReduced(QThreadPool *pool,
Iterator begin,
Iterator end,
@ -299,10 +333,15 @@ QFuture<ResultType> mappedReduced(QThreadPool *pool,
options);
}
#ifdef Q_CLANG_QDOC
template <typename Iterator, typename MapFunctor, typename ReduceFunctor, typename ResultType,
typename InitialValueType>
#else
template <typename Iterator, typename MapFunctor, typename ReduceFunctor,
typename ResultType = typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
QFuture<ResultType> mappedReduced(Iterator begin,
Iterator end,
MapFunctor map,
@ -415,9 +454,14 @@ ResultType blockingMappedReduced(Sequence &&sequence,
return future.takeResult();
}
#ifdef Q_CLANG_QDOC
template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, 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 <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, 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 <typename MapFunctor, typename ReduceFunctor, typename Sequence, typename ResultType,
typename InitialValueType>
#else
template <typename MapFunctor, typename ReduceFunctor, typename Sequence,
typename ResultType = typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, 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 <typename MapFunctor, typename ReduceFunctor, typename Sequence, typename ResultType,
typename InitialValueType>
#else
template <typename MapFunctor, typename ReduceFunctor, typename Sequence,
typename ResultType = typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, 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 <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, 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 <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType>
#else
template <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, 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 <typename Iterator, typename MapFunctor, typename ReduceFunctor, typename ResultType,
typename InitialValueType>
#else
template <typename Iterator, typename MapFunctor, typename ReduceFunctor,
typename ResultType = typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, 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 <typename Iterator, typename MapFunctor, typename ReduceFunctor, typename ResultType,
typename InitialValueType>
#else
template <typename Iterator, typename MapFunctor, typename ReduceFunctor,
typename ResultType = typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType,
typename InitialValueType,
std::enable_if_t<std::is_convertible_v<InitialValueType, ResultType>, int> = 0>
#endif
ResultType blockingMappedReduced(Iterator begin,
Iterator end,
MapFunctor map,