title: std::map::find()
body: <p>I have a simple struct which i'm using as a key in a std::map</p>
  
  <pre><code>struct PpointKey{
          unsigned int xp,yp; //pixel coordinates
  
          unsigned int side;
  
          PpointKey(unsigned xp,unsigned yp,unsigned side=5):xp(xp),yp(yp),side(side)
          {}  
  
  
          bool operator==(const PpointKey&amp; other) const{
                  const unsigned int x = other.xp;
                  const unsigned int y = other.yp;
  
                  return ((x&gt;=xp &amp;&amp; x&lt;=xp+side) &amp;&amp; (y&gt;=yp &amp;&amp; y&lt;=yp+side));
          }   
  
          bool operator&lt;(const PpointKey&amp; other) const{
  
                  const unsigned int x = other.xp;
                  const unsigned int y = other.yp;
  
                  const unsigned  other_distance_2 = x*x + y*y;
  
                  const unsigned  this_distance_2 = this-&gt;xp*this-&gt;xp + this-&gt;yp * this-&gt;yp;
  
                  return this_distance_2 &lt; other_distance_2;
          }   
  };
  </code></pre>
  
  <p>What I would like to achieve is to use the find() to access the map with a key that has its xp,yp attributes within a <code>side</code> distance. In other words, if I have an (x,y) tuple, I would like to find inside the map the first PpointKey that fulfils the condition inside the operator== function</p>
  
  <pre><code>return ((x&gt;=xp &amp;&amp; x&lt;=xp+side) &amp;&amp; (y&gt;=yp &amp;&amp; y&lt;=yp+side));
  </code></pre>
  
  <p>Is this possible using find? I'm getting map.end(), so I would like to check wheter the find () function uses the operator==. Maybe the search algorithm would be better?</p>
  
  <p>Thanks in advance.</p>