Iterates over the indices of an object.