title: C++ compare vector iterator with instance
body: <p>I need to write a function that removes the received element from a vector.
  I think the way to do this is to parse the vector and compare the iterator with the reference passed. The problem is that I cannot compare the type iterator with type object reference...</p>
  
  <p><strong>BELOW THE ACTUAL CODE (Edit: originally I posted a much simplified version)</strong></p>
  
  <pre><code>struct BufferPoint{int x; int y; float pressure; };
  
  class QueueState
  {
  public:
          VectorCurve *curveVector;
          RasterCurve *curveRaster;
          vector&lt;BufferPoint&gt; *curveBuffer;
          QueueState(vector&lt;BufferPoint&gt; *_b, VectorCurve *_v, RasterCurve *_r){ curveBuffer= _b; curveVector = _v; curveRaster = _r;};
  };
  
  
  vector&lt;vector&lt;BufferPoint&gt;&gt; queueBuffers;
  vector&lt;QueueState&gt; queueStates;
  
  
  [...]
  
  
  // FIND AND REMOVE A BUFFER OBJECT
  for(std::vector&lt;QueueState&gt;::iterator it = queueStates.begin(); it != queueStates.end(); ++it) 
  {   
  
      //Remove buffer from pool (queue)
      //////////////////////////////////////////////////////////////////////////
      if((it-&gt;curveVector-&gt;state == CURVEDATA_STATE_FINISHED) &amp; (it-&gt;curveRaster-&gt;state == CURVEDATA_STATE_FINISHED))
      {
          queueBuffers.erase(std::find(queueBuffers.begin(), queueBuffers.end(), *(it-&gt;curveBuffer)));  // &lt;-- THIS DOESNT WORK. CHECK BELOW FOR ERROR MESSAGE (1)
          queueStates.erase(it);
      }
      //////////////////////////////////////////////////////////////////////////
  }
  </code></pre>
  
  <p>(1) This is the message I get from the compiler: </p>
  
  <pre><code>Error   error C2678: binary '==' : no operator found which takes a left-hand operand of type 'const BufferPoint' (or there is no acceptable conversion) c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility 2956
  </code></pre>