title: What is the best way to sort a vector leaving the original one unaltered?
body: <p>As the title says, I'm looking for a way to sort a vector without modifying the original one.
  My first idea is of course to create a copy of the vector before the sort, e.g.:</p>
  
  <pre><code>std::vector&lt;int&gt; not_in_place_sort(const std::vector&lt;int&gt;&amp; original)
  {
     auto copy = original;
     std::sort(copy.begin(), copy.end());
     return copy;
  }
  </code></pre>
  
  <p>However, maybe there is a more efficient way to perform the sort using C++ standard algorithm (maybe a combination of <code>sort</code> and <code>transform</code>?) </p>