title: Expression: Invalid Operator < - Can't find the error
body: <pre><code>if(!projectiles.empty()){
          sort(projectiles.rbegin(), projectiles.rend()); //Occasionally I get bad sort error. No idea why.
      }
  </code></pre>
  
  <p>projectiles is an std::vector full of projectile structs. These are added each frame if a "fire" command is executed, and removed each frame automatically if they time out. </p>
  
  <p>In projectile:</p>
  
  <pre><code>bool operator &lt; (const projectile&amp; proj) const
  {
      return (D3DXVec3Dot(&amp;pos, p_camera.GetWorldAhead()) &lt; D3DXVec3Dot(&amp;proj.pos, p_camera.GetWorldAhead()));
  }
  </code></pre>
  
  <p>...pos is a D3DXVECTOR3 with the projectile's position in 3D space - that works (the sorting is for depth checks while alpha blending). For those wondering, D3DXVec3Dot returns a float. But occasionally, especially with lots of projectiles on the screen, it throws:</p>
  
  <blockquote>
    <p>Debug Assertion Failed!</p>
    
    <p>Program: C:\Windows\system32\MSVCP110D.dll File:
    e:\applications\vc\include\algorithm Line: 3566</p>
    
    <p>Expression: invalid operator&lt;</p>
    
    <p>For information on how your program can cause an assertion failure,
    see the Visual C++ documentation on asserts.</p>
  </blockquote>
  
  <p>Not sure why. Any help is much appreciated. </p>