Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qtconcurrentfilter

\title Concurrent Filter and Filter-Reduce

Selecting values from a sequence and combining them, all in parallel.

The QtConcurrent::filter(), QtConcurrent::filtered() and QtConcurrent::filteredReduced() functions filter items in a sequence such as a QList in parallel. QtConcurrent::filter() modifies a sequence in-place, QtConcurrent::filtered() returns a new sequence containing the filtered content, and QtConcurrent::filteredReduced() returns a single result.

These functions are part of the \l {Qt Concurrent} framework.

Each of the above functions have a blocking variant that returns the final result instead of a QFuture. You use them in the same way as the asynchronous variants.

// each call blocks until the entire operation is finished
Definition qset.h:18
\inmodule QtCore
void blockingFilter(QThreadPool *pool, Sequence &sequence, KeepFunctor &&keep)
Calls filterFunction once for each item in sequence.
ResultType blockingFilteredReduced(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&keep, ReduceFunctor &&reduce, ReduceOptions options=ReduceOptions(UnorderedReduce|SequentialReduce))
std::decay_t< Sequence > blockingFiltered(QThreadPool *pool, Sequence &&sequence, KeepFunctor &&keep)
Calls filterFunction once for each item in sequence and returns a new Sequence of kept items.
GLsizei const GLchar ** strings
[1]
QFuture< QString > lowerCaseStrings
bool allLowerCase(const QString &string)
[0]
QFuture< QSet< QString > > dictionary

Note that the result types above are not QFuture objects, but real result types (in this case, QStringList and QSet<QString>).