title: Move-initialize a priority_queue from a vector?
body: <p>I saw this <a href="https://leetcode.com/problems/merge-k-sorted-lists/description/" rel="nofollow noreferrer">leetcode question</a> and wanted to solve it with a priority queue instead of a vector (thus O(nlogk) instead of O(nk)). How do I move-initialize the priority_queue with the given vector as the underlying container? This is what I tried but I clearly misunderstood the <a href="http://en.cppreference.com/w/cpp/container/priority_queue/priority_queue" rel="nofollow noreferrer">docs</a> because it won't compile.</p>
  
  <pre><code>struct ListNode {
      int val;
      ListNode *next;
      ListNode(int x) : val(x), next(NULL) {}
  };
  
  class cmp{
      public:
      bool operator()(const ListNode *a,const ListNode *b) const {
          if(b==nullptr) return false;
          return a==nullptr || a-&gt;val&gt;b-&gt;val;
      }
  };
  class Solution {
      ListNode* helper(auto&amp; lists) {
          ListNode *ans=lists.top();lists.pop();
          if(ans==nullptr) return nullptr;
          lists.push(ans-&gt;next);
          ans-&gt;next=helper(lists);
          return ans;
      }
  public:
      ListNode* mergeKLists(vector&lt;ListNode*&gt;&amp; lists) {
          if(lists.empty()) return nullptr;
          priority_queue&lt;ListNode*,vector&lt;ListNode*&gt;&gt; pq(cmp,std::move(lists)); //compiler says error: 'std::move' is not a type
          return helper(pq);
      }
  };
  </code></pre>