Boost logo

Boost Users :

Subject: Re: [Boost-users] Clever simultaneous iteration over multiple containers
From: Joseph Wakeling (joseph.wakeling_at_[hidden])
Date: 2010-03-14 09:55:09


Steven Watanabe wrote:
> To use zip_iterator, you would need something like
> std::make_pair(boost::make_zip_iterator(boost::make_tuple(v1.begin(),
> v2.begin())), boost::make_zip_iterator(boost::make_tuple(v1.end(),
> v2.end())));
>
> The RangeEx library which has been accepted, but is not
> yet in the trunk, also provides a zip operation that works
> with ranges instead of iterators.

OK ... so maybe just worth waiting a little while for an updated boost,
and maintaining the code as it stands?

I read the documentation for zip_iterator and its description of
something quite similar to what you describe -- what put me off was that
whereas the for(i=...) syntax is pretty easy to read, and the
BOOST_FOREACH syntax is wonderfully simple, the zip_iterator syntax
seems complicated and unfriendly to someone reading the code. I'm
anxious to preserve the ease of understanding of code where possible.

Thanks for your thoughts and advice!

Best wishes,

    -- Joe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net