As you say, I think the safest approach will be doing the manual iteration like this, but just in one spot.

(The precomposition should just be used for the reference iterators.)