title: std::sort fail to work when input vector has called reserve
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;cmath&gt;
  #include &lt;algorithm&gt;
  #include &lt;random&gt;
  
  
  int main()
  {
  std::random_device rd;
  std::mt19937 gen(rd());
  std::uniform_real_distribution&lt;&gt; dis(-1.0, 1.0);
  std::vector&lt;float&gt; s;
  s.reserve(10);
  for (int i=0; i&lt; 10; ++i) s[i] = dis(gen);
  for (int i=0; i&lt; 10; ++i) std::cout &lt;&lt; s[i] &lt;&lt; " ";
  std::cout &lt;&lt; std::endl;
  std::sort(s.begin(), s.end());
  for (int i=0; i&lt; 10; ++i) std::cout &lt;&lt; s[i] &lt;&lt; " ";
  std::cout &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>
  the output is:
  0.459711 0.0240773 -0.395009 0.574655 -0.244166 -0.343489 -0.520125 0.746452 0.858716 0.765223 
  0.459711 0.0240773 -0.395009 0.574655 -0.244166 -0.343489 -0.520125 0.746452 0.858716 0.765223 
  std::sort fail to work!!!
  </p>