PDA

View Full Version : QtConcurrent::mappedReduced



wookoon
8th November 2010, 08:11
QStringList PaltUnit::dayMap(QStringList s)
{
......
}

void PaltUnit:upReduce(QStringList &res,QStringList s)
{
......
}

QStringList PaltUnit::solutionPick()
{
QVector<QStringList> vec;

vec = divStockData(DIVIDEDAYS);

QFuture<QStringList> res = QtConcurrent::mappedReduced<QStringList>(vec, dayMap, upReduce);

return res;
}


the buildissues will show : argument of type 'QStringList(PaltUnit::*)(QStringList)' does not match 'QStringList(PaltUnit::*)(QStringList)' ï¼›
QStringList(PaltUnit::*)(QStringList) is not a class,struct, or union type

If I made "dayMap" and "upReduce" to be globe function, then will build pass. Why..?

So If I want made "dayMap" and "upReduce" still be the member functions of the PaltUnit, what should I do?

wysota
8th November 2010, 09:53
If I made "dayMap" and "upReduce" to be globe function, then will build pass. Why..?
There are numerous problems with your current call.


So If I want made "dayMap" and "upReduce" still be the member functions of the PaltUnit, what should I do?
One thing would be to make them static.

But in the current for your code makes completely no sense, you might want to use blockingMappedReduced() instead.