QtConcurrent::blockingMapped 使用超过 1 个参数调用函数

QtConcurrent::blockingMapped calling function with more than 1 argument

我使用 QtConcurrent::blockingMapped() 在多个线程上执行单个参数列表上的函数。真的很棒!

但我想做同样的事情,调用接受多个参数的函数,即:

// prototype:

static void openAndProcess(QString FileName, QImage &image);

这是我的数据:

QList<QString> fileList;
QList<QImage> qImageList;

而且我想在我的 openAndProcess() 函数上执行 QtConcurrent::blockingMapped() 使用上面的两个 QLists...

我应该怎么做?

提前致谢!

创建一个带有数据指针的 POD 结构。这是唯一无需在 QtConcurrent 中重新实现许多无趣事物的方法。

或者,考虑使用 QList<QPair<QString, QImage> >,这实际上是一样的。