That is correct, the code iterates over the vehicles vector, a copy of veh_in_nonant. If a vehicle gets destroyed (and therefor removed from the submap), it is only removed from veh_in_nonant, not from the vehicles vector. I check to see if the current vehicle is still in the submap vehicle list, if not it has been destroyed and is ignored. Up to this point only vehicle pointers are compared, which is safe even if those pointers point to deleted objects. Making veh_in_nonant a reference is purely laziness, I didn't want to write `grid[nonant]->vehicles` in the call to `std::find`.