title: How to detect a collision between any two points in two vectors of points (C++)?
body: <p>I have a class like this:</p>
  
  <pre><code>class Point
  {
  public:
     int x;
     int y;
  
     bool operator==( Point&amp; other )
     {
         return (x == other.x) &amp;&amp; (y = other.y);
     }
  };
  </code></pre>
  
  <p>Then I have a rudimentary Sprite class which has a vector of points, and many other members/methods which I'm not showing below:</p>
  
  <pre><code>class Sprite
  {
     std::vector&lt;Point&gt; points;
  };
  </code></pre>
  
  <p>Now how do you find any Point in the vector of a Sprite object that collides with any other point in the vector of another Sprite object, using the operator== in the Point class? I've tried something like the following but it doesn't work quite right. <strong>Size()</strong> returns the total number of points in the vector of points and <strong>Points()</strong> returns the vector of points:</p>
  
  <pre><code>bool Sprite::CollidesWith( Sprite* other )
  {
    for ( int ixThis = 0; ixThis &lt; Size(); ixThis++ ) {
      for ( int ixOther = 0; ixOther &lt; other-&gt;Size(); ixOther++ ) {
        if ( points-&gt;at(ixThis) == other-&gt;Points()-&gt;at(ixOther) )
          return true;
      }
    }
  
    return false;
  }
  </code></pre>
  
  <p>Any ideas?</p>