Use forward iterators instead of output iterators.