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

QMap and QHash don't support move insertion

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Out of scope
    • Icon: Not Evaluated Not Evaluated
    • None
    • None
    • None

      There is no way to insert an object that is moveable but not copiable.

      Example:

          std::unique_ptr<A> ptr(new A);
          std::unique_ptr<A> ptr2(new A);
      
          std::map<int, std::unique_ptr<A>> m;
      
          m[0] = std::move(ptr); //works
          m.insert(std::make_pair(1, std::move(ptr2))); //works
      
          QMap<int, std::unique_ptr<A>> m2;
          m2.insert(0, std::move(ptr)); //fails
      

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

            thiago Thiago Macieira
            alcinos alcinos
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes