Use iterators in inner product impl