$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] BOOST_FOREACH question
From: John Reid (j.reid_at_[hidden])
Date: 2009-06-18 02:45:29
Zachary Turner wrote:
> Suppose I've got a concrete instance C of some class, and a pair of
> iterators X and Y representing a range [X, Y).  I want to do the
> following:
> 
> int a, b, c;
> while (X != Y)
> {
>    C.foo(*X, a, b, c);
>    ++X;
> }
> 
> I can type it out like that, but actually X and Y are zip_iterators,
> and it's hard for me to figure out how to parameterize the
> zip_iterator to instantiate it.  I tried the following:
> 
I would try (using boost.iterator and boost.range):
BOOST_FOREACH(
     <value type of iterator> x,
     boost::make_iterator_range( X, Y )
) {
        C.foo( x, a, b, c );
}
Perhaps you know the value type of the iterator or you should be able to 
derive it.