title: How to sort an object std::vector by its float value
body: <p>I have a C++ std::vector denoted as:</p>
  
  <pre><code>std::vector&lt;GameObject*&gt; vectorToSort;
  </code></pre>
  
  <p>Each object in vectorToSort contains a float parameter which is returned by calling "DistanceFromCamera()":</p>
  
  <pre><code>vectorToSort.at(position)-&gt;DistanceFromCamera();
  </code></pre>
  
  <p>I wish to sort the vector by this float parameter however std::sort does not appear to be able to do this. How can I achieve this sort?</p>