Hi,

I want to use QtConcurrent::mappedReduced with only Functors but compiler says:

Qt Code:
  1. error: no matching function for call to ‘mappedReduced(const int*, const int*, MapS, ReduceS)’
To copy to clipboard, switch view to plain text mode 

the map functor works but the reducer not.
the code is:

Qt Code:
  1. struct MapS
  2. {
  3. typedef int result_type;
  4.  
  5. int operator()( int v )
  6. {
  7. return v;
  8. }
  9. };
  10.  
  11. struct ReduceS
  12. {
  13. typedef int result_type;
  14. void operator()( int & r, const int & v )
  15. {
  16. r+=v;
  17. }
  18. };
  19.  
  20. int main( int argc, char ** argv )
  21. {
  22. QVector<int> vector( 1024, 1 );
  23. for( int i = 0; i < vector.count(); ++i )
  24. vector[i]=i+1;
  25.  
  26. qDebug() << QtConcurrent::mappedReduced( vector.constBegin(), vector.constEnd(), MapS(), ReduceS() );
  27.  
  28. return 0;
  29. }
To copy to clipboard, switch view to plain text mode 

so, is possible to use Functor Object as reduce functor? and how it must be defined?

Thanks.