title: So can unique_ptr be used safely in stl collections?
body: <p>I am confused with unique_ptr and rvalue move philosophy.</p>
  
  <p>Let's say we have two collections:</p>
  
  <pre><code>std::vector&lt;std::auto_ptr&lt;int&gt;&gt; autoCollection;
  std::vector&lt;std::unique_ptr&lt;int&gt;&gt; uniqueCollection;
  </code></pre>
  
  <p>Now I would expect the following to fail, as there is no telling what the algorithm is doing internally and maybe making internal pivot copies and the like, thus ripping away ownership from the auto_ptr:</p>
  
  <pre><code>std::sort(autoCollection.begin(), autoCollection.end());
  </code></pre>
  
  <p>I get this.  And the compiler rightly disallows this happening.</p>
  
  <p>But then I do this:</p>
  
  <pre><code>std::sort(uniqueCollection.begin(), uniqueCollection.end());
  </code></pre>
  
  <p>And this compiles.  And I do not understand why.  I did not think unique_ptrs could be copied.  Does this mean a pivot value cannot be taken, so the sort is less efficient?  Or is this pivot actually a move, which in fact is as dangerous as the collection of auto_ptrs, and should be disallowed by the compiler?</p>
  
  <p>I think I am missing some crucial piece of information, so I eagerly await someone to supply me with the aha! moment.</p>