Hi,
just a short question: Why does not the zip_iterator header have the
following (or something along the lines of the following) creator function:
template
boost::zip_iterator >
make_zip_iterator(Iter1Type i, Iter2Type j)
{
return boost::make_zip_iterator(boost::make_tuple(i, j));
}
That would make creating a zip_iterator much simpler. Instead of
writing the following:
std::set<double> s;
std::vector<int> v;
// populate s and v....
std::for_each(boost::make_zip_iterator(boost::make_tuple(s.begin(),
v.begin())),
boost::make_zip_iterator(boost::make_tuple(s.end(),
v.end())),
my_functor_that_does_something_useful());
you could write the following:
std::set<double> aSet;
std::vector<int> aVector;
// populate aSet and aVector....
std::for_each(boost::make_zip_iterator(aSet.begin(), aVector.begin()),
boost::make_zip_iterator(aSet.end(), aVector.end())),
my_functor_that_does_something_useful());
Regards,
Erik Åldstedt Sund