title: Best algorithm to check whether a vector is sorted
body: <p>What would be the best way to check that a <code>std::vector</code> is sorted? Is there something faster than a loop checking that <code>v[i]&lt;=v[i+1]</code>? Is it faster/cleaner with iterators? Or is it actually better to just call <code>sort</code> every time (though the "v is already sorted" case is quite common)?</p>
  
  <p>We can safely assume the vector only contains PODs, usually <code>float</code>s and sometimes <code>double</code>s and <code>int</code>s.</p>
  
  <p>The size of the vector is non-trivial (usually a few thousands items) but not extreme (not gigabyte-sized).</p>
  
  <ul>
  <li>in some instances we'll sort the vector immediately afterwards, however there are other instances where we don't (it's an error case of our algorithm).</li>
  <li>we already use a flag "IsSorted" whenever possible.</li>
  </ul>