Boost logo

Boost :

Subject: Re: [boost] [General] A standard idiom or technique?
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2008-10-24 05:09:21

On Fri, Oct 24, 2008 at 9:56 AM, <mbiddeg_at_[hidden]> wrote:

> The tuple-based solution seems elegant if you have a varying number of
> ranges.
> For your two ranges requirement, a simple custom writing of a for_each
> would do, like this:
> template<class ForwardIterator, class ForwardIterator2, Class Op>
> Op for_each(ForwardIterator first, ForwardIterator last, ForwardIterator2
> first2, Op op){
> for(;first != last; ++first, ++first2)
> op(*(first), *(first2));
> return (op);
> }
> Does this work for you?

I was thinking more of the general case, rather than two ranges
specifically. However
I do appreciate that for simple cases the simple solution is often the best,
as it probably
would be here.

Many Thanks.

- Rob.

Boost list run by bdawes at, gregod at, cpdaniel at, john at