title: Is partial_sort_copy the fastest C++ partial sort?
body: <p>Consider the following function, <code>median</code>:</p>
  
  <pre><code>  real_t median(const std::initializer_list&lt;real_t&gt; vars) {
      real_t tmp[15];
      const unsigned x = vars.size() / 2;
      if (x &amp; 1) {
        std::partial_sort_copy(vars.begin(), vars.end(), &amp;tmp[0], &amp;tmp[x]);
        return tmp[x];
      }
      const unsigned y = x + 1;
      std::partial_sort_copy(vars.begin(), vars.end(), &amp;tmp[0], &amp;tmp[y]);
      return (tmp[x] + tmp[y]) / 2;
    }
  </code></pre>
  
  <p>I am using a partial sort to decrease complexity, as I only need to sort half of the list.</p>
  
  <p>Further, I have assumed that <code>std::partial_sort_copy</code> is faster than <code>std::partial_sort</code> or <code>std::nth_element</code> because there is no shuffling required in the sort algorithm (It1 != It2). Is my assumption correct?</p>
  
  <hr>
  
  <p>NB: Assume <code>real_t</code> could be a <code>double</code>, so please don't criticise the use of division.</p>
  
  <p>NBB: I'm using <code>-pedantic</code> and <code>vars</code> is known to not be longer than 15 elements.</p>