Sorry for the terrible formatting. As another example, here is C++ code 
that would do what I want using iterators.


typedef std::vector<cSpot> spots_t;
spots_t cSpots;

// Fill cSpots here ...

CLatLngBox cLatLngBox;

for(int i=0; i<72; i++)
  {
  // Move cLatLngBox to the next block ..

  // Our new cluster.
  CCluster cCluster;

  // Iterate points.
  spots_t::iterator itr = cSpots.begin ();
  for(itr; itr!=cSpots.end();)
    {
     if(cLatLngBox.is_in_box(*itr))
       {
       // Add to cluster.

       // This is where we remove the spot.
       itr = cSpots.erase(itr);
       }
     else
       {
       if((*itr).lng > cLatLngBox.lng)
         {
         // Done with the inner loop.
         break;
         }

       // Next spot.
       itr++;
       }
    }
  }
-- 
Posted via http://www.ruby-forum.com/.