Hello, I've been trying to get QtConcurrent::blockingMappedReduced to run using a couple of lambda's and keep running into a compile issue which I can't get to the bottom of. I've cut it right back and am currently using Qt's own example code converted into lambda's and getting the same error. So here it is:

Qt Code:
  1. typedef QMap<QString, int> WordCount;
  2.  
  3. void ClassName::ProcessStuff() {
  4. auto wordMapFn = [&](const QString &file) -> WordCount {
  5. QFile f(file);
  6. f.open(QIODevice::ReadOnly);
  7. QTextStream textStream(&f);
  8. WordCount wordCount;
  9.  
  10. while (textStream.atEnd() == false)
  11. foreach (QString word, textStream.readLine().split(" "))
  12. wordCount[word] += 1;
  13.  
  14. return wordCount;
  15. };
  16.  
  17. auto wordReduceFn = [&](WordCount &result, const WordCount &w) {
  18. QMapIterator<QString, int> i(w);
  19. while (i.hasNext()) {
  20. i.next();
  21. result[i.key()] += i.value();
  22. }
  23. };
  24. QStringList files;
  25. WordCount total = QtConcurrent::blockingMappedReduced(files.begin(), files.end(), wordMapFn, wordReduceFn);
  26. }
To copy to clipboard, switch view to plain text mode 

Compiling this in VS2012 with Qt5.0.2 produces the following error:
Qt Code:
  1. 1>Implementation\ImportExport\OpcExporter.cpp(250): error C2893: Failed to specialize function template 'QtPrivate::ReduceResultType<ReduceFunctor>::ResultType QtConcurrent::blockingMappedReduced(Iterator,Iterator,MapFunctor,ReduceFunctor,QtConcurrent::ReduceOptions)'
  2. 1> With the following template arguments:
  3. 1> 'QList<T>::iterator'
  4. 1> with
  5. 1> [
  6. 1> T=QString
  7. 1> ]
  8. 1> 'ImportExport::OpcExporter::CreateProjectChildAndAttachedParts::<lambda_34d77ea4bb1263c3043c2eae1f2efb26>'
  9. 1> 'ImportExport::OpcExporter::CreateProjectChildAndAttachedParts::<lambda_0b977c9c36b310423ccf2f5f1c540fb3>'
  10. 1>Implementation\ImportExport\OpcExporter.cpp(250): error C2783: 'ResultType QtConcurrent::blockingMappedReduced(Iterator,Iterator,MapFunctor,ReduceFunctor,QtConcurrent::ReduceOptions)' : could not deduce template argument for 'ResultType'
  11. 1> c:\qt\qt5.0.2\5.0.2\msvc2012_64\include\qtconcurrent\qtconcurrentmap.h(237) : see declaration of 'QtConcurrent::blockingMappedReduced'
  12. 1>Implementation\ImportExport\OpcExporter.cpp(250): error C2893: Failed to specialize function template 'QtPrivate::ReduceResultType<ReduceFunctor>::ResultType QtConcurrent::blockingMappedReduced(const Sequence &,MapFunctor,ReduceFunctor,QtConcurrent::ReduceOptions)'
  13. 1> With the following template arguments:
  14. 1> 'QList<T>::iterator'
  15. 1> with
  16. 1> [
  17. 1> T=QString
  18. 1> ]
  19. 1> 'ImportExport::OpcExporter::CreateProjectChildAndAttachedParts::<lambda_34d77ea4bb1263c3043c2eae1f2efb26>'
  20. 1> 'QList<T>::iterator'
  21. 1> with
  22. 1> [
  23. 1> T=QString
  24. 1> ]
  25. 1>Implementation\ImportExport\OpcExporter.cpp(250): error C2783: 'ResultType QtConcurrent::blockingMappedReduced(const Sequence &,MapFunctor,ReduceFunctor,QtConcurrent::ReduceOptions)' : could not deduce template argument for 'ResultType'
  26. 1> c:\qt\qt5.0.2\5.0.2\msvc2012_64\include\qtconcurrent\qtconcurrentmap.h(208) : see declaration of 'QtConcurrent::blockingMappedReduced'
  27. 1>
  28. 1>Build FAILED.
To copy to clipboard, switch view to plain text mode 

Any help much appreciated.