title: Moving unique_ptrs from one vector to another
body: <p>I'd like to move the unique_ptr's stored in an unsorted vector of them to another vector, that will contain the sorted vector of pointers.</p>
  
  <p>Surely moving a unique_ptr will not automatically erase the element in the first vector? How can I do this?</p>
  
  <p>Example of what I want to do:</p>
  
  <pre><code>std::vector&lt;std::unique_ptr&lt;T&gt; &gt; unsorted, sorted;
  // fill the "unsorted" vector
  while( unsorted.size() &gt; 0 )
  {
      const auto it = find_next_element_to_add_to_sorted(unsorted);
      sorted.push_back( std::move(*it) );
  }
  </code></pre>
  
  <p>I hope the intent is clear.</p>
  
  <p><strong>UPDATE</strong>: <a href="http://www.electricmonk.nl/log/2008/08/07/dependency-resolving-algorithm/">my algorithm</a> does not allow sorting in-place. If anyone is feeling nice today (I am not asking, see above for my question), feel free to implement it for this situation and show me. I really need the "sort by move". And I don't really see why the moving would be <em>that</em> much more expensive.</p>