ITeye博客

QtConcurrent::mappedReduced使用仿函数(functor)

johnsmith9th · 2022-04-11 12:38 · Qt · 编程语言 · Markdown

参考https://stackoverflow.com/questions/17019954/specifying-reduce-functor-for-mappedreduce

有三个要点:

1. MapFunctor必须定义result_type类型: 例如 typedef QList<int> result_type.

2. ReduceFunctor的operator()函数的第一个参数即是最终的结果

3. 调用blockingMappedReduced或者mappedReduced时需要显示指定模板参数的类型而不能依赖编译器推导。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。