QT多线程QtConcurrent

时间:2022-12-31 01:16:11

QtConcurrent

Map & Map-Reduce

https://blog.csdn.net/douzhq/article/details/104758445

QtConcurrent::map(): 替换

QFuture<void> map(Sequence &sequence, MapFunctor map)

对序列的每一项元素都应用一个函数,并将运算结果替换原来的元素。

QtConcurrent::mapped(): 新容器存储

QtConcurrent::mappedReduced(): 使用reduce处理为单个的值

template <typename Sequence, typename MapFunctor, typename ReduceFunctor> QFuture<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType> mappedReduced(const Sequence &sequence, MapFunctor map, ReduceFunctor reduce, ReduceOptions options = ReduceOptions(UnorderedReduce | SequentialReduce))

QtConcurrent::run()

https://blog.csdn.net/hitzsf/article/details/117784432

该函数可能不会立即运行; 函数只有在线程可用时才会运行。