Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtConcurrent::Mapped returns QFuture<void>
Qt 6.11 is out! See what's new in the release blog

QtConcurrent::Mapped returns QFuture<void>

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DrZod
    wrote on last edited by
    #1

    I have a QList<T*> and my map functions takes T* and returns an object of U type, I don't understand why when calling QtConcurrent::Mapped returns QFuture<void> shouldn't it return QFuture<U>?. How is the return type of QtConcurrent::Mapped decided?

    jsulmJ 1 Reply Last reply
    0
    • D DrZod

      I have a QList<T*> and my map functions takes T* and returns an object of U type, I don't understand why when calling QtConcurrent::Mapped returns QFuture<void> shouldn't it return QFuture<U>?. How is the return type of QtConcurrent::Mapped decided?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @DrZod Please show how you call QtConcurrent::mapped

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        DrZod
        wrote on last edited by DrZod
        #3

        @jsulm

        QList<T*> list = ....
        auto mapFunction = [std::biset<10U> bitset](const T* t)->U {return t->someFunction(bitset);}      //someFunction() return U
        
        QFuture<U> futures = QtConcurrent::mapped(list,mapFunction)
        jsulmJ 1 Reply Last reply
        0
        • D DrZod

          @jsulm

          QList<T*> list = ....
          auto mapFunction = [std::biset<10U> bitset](const T* t)->U {return t->someFunction(bitset);}      //someFunction() return U
          
          QFuture<U> futures = QtConcurrent::mapped(list,mapFunction)
          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @DrZod But how do you know that it returns QFuture<void>?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DrZod
            wrote on last edited by
            #5

            @jsulm

            Because the code doesn't compile. I am using MSVC and the error message says that there is no conversion from QFuture<void> to QFuture<U>.

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Can you test it temporary with a static function and /or const ref instead pointer? What MSVC compiler do you use?

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved