Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-88448

QtConcurrent filter/map does not work with reductor object

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 6.0
    • Core: QtConcurrent
    • None
    • 8
    • Qt6_Foundation_Sprint 37, Qt6_Foundation_Sprint 38

    Description

      Whenever using an object with "operator()" as reductor, compilation fails with the error

      error: no matching function for call to ‘blockingMappedReduced ....
      

      First the error message is not helpful at all.
      Second this should work.

      Reproducer below.

      void tst_QtConcurrentFilterMapGenerated::test1()
      {
          /* test for
          template<typename typename ResultType, typename Sequence, typename MapFunctor, typename
          ReduceFunctor> ResultType blockingMappedReduced(QThreadPool* pool, const Sequence & sequence,
          MapFunctor function, ReduceFunctor reduceFunction, ReduceOptions);
      
          with
            inputsequence=standard
            inputsequencepassing=lvalue
            inputitemtype=standard
            maptype=same
            mappeditemtype=standard
            reductiontype=same
            reductionitemtype=standard
            mapfunction=functor
            mapfunctionpassing=lvalue
            reductionfunction=functor
            reductionfunctionpassing=lvalue
            reductionoptions=unspecified
          */
      
          QThreadPool pool;
          pool.setMaxThreadCount(1);
          auto input_sequence = []() {
              std::vector<SequenceItem<tag_input>> result;
              result.push_back(SequenceItem<tag_input>(1, true));
              result.push_back(SequenceItem<tag_input>(2, true));
              result.push_back(SequenceItem<tag_input>(3, true));
              result.push_back(SequenceItem<tag_input>(4, true));
              result.push_back(SequenceItem<tag_input>(5, true));
              result.push_back(SequenceItem<tag_input>(6, true));
              return result;
          }();
      
          auto map = MyMap<SequenceItem<tag_input>, SequenceItem<tag_input>> {};
          auto reductor = MyReduce<SequenceItem<tag_input>, SequenceItem<tag_input>> {};
      
          auto result = QtConcurrent::blockingMappedReduced(&pool, input_sequence, map, reductor);
      
          auto expected_result = SequenceItem<tag_input>(42, true);
      
          QCOMPARE(result, expected_result);
      }
      
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sonakur Sona Kurazyan
            andreasbuhr Andreas Buhr
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes