do not (implicitly) dereference iterator many times, cache it instead