title: c++ std::vector std::sort infinite loop
body: <p>I ran across an issue whenever I was trying to sort a vector of objects that was resulting in an infinite loop.  I am using a custom compare function that I passed in to the sort function.  </p>
  
  <p>I was able to fix the issue by returning false when two objects were equal instead of true but I don't fully understand the solution.  I think it's because my compare function was violating this rule as outlined on cplusplus.com:</p>
  
  <blockquote>
    <p>Comparison function object that,
    taking two values of the same type
    than those contained in the range,
    returns true if the first argument
    goes before the second argument in the
    specific strict weak ordering it
    defines, and false otherwise.</p>
  </blockquote>
  
  <p>Can anyone provide a more detailed explanation? </p>