title: remove_if comparing two elements in the same vector
body: <p>I have a vector of objects. Lets call them "myObj". I need to run through the vector of myObj and determine if the current object interacts with another myObj in that vector and remove both objects if either has interacted with the other.</p>
  
  <pre><code>for (std::vector&lt;myObj*&gt;::iterator it = objects.begin(); it &lt; objects.end(); ++it)
  {
      myObj*&amp; r1 = (*it);
      myObj*&amp; r2 = (*(it + 1));
      if ( r1-&gt;interactsWith(r2) )
      {
          objectInteracted(r1);
          objectInteracted(r2);
          delete r1;
          delete r2;
          r1 = NULL;
          r2 = NULL;
          ++it;
      }
  }
  
  objects.erase(std::remove(objects.begin(), objects.end(), NULL), objects.end()); //Causing "no conversion from const int to myObj"
  </code></pre>
  
  <p>As you can see, I'm attempting to use the remove-erase idiom to clear these objects out of the vector. However, when trying to compile, I get an error: "C2446 '==': no conversion from 'const int' to 'myObj *'</p>
  
  <p>I would much prefer to use the remove_if function but since my predicate would need to take in and compare two elements in the same vector, I have no idea how to correctly construct the predicate. Could someone either tell me why I'm getting the compilation error, or show me how to construct a correct predicate for the above? I've Google for hours and have found no examples whatsoever that show predicates with more complex behaviour than, say, removing odd numbers from a list which naturally doesn't require any input except the element currently being tested.</p>