size_t LocationManager::GetNrLocationsWithin(Location const &loc, double const distance) const { size_t nrOfLocations = 0; for_each(mLocations.begin(), mLocations.end(), [&nrOfLocations, &loc, distance](Location const &location) { // check location if (loc.GetDistance(location) < distance) nrOfLocations++; }); return nrOfLocations; }