Boost logo

Boost :

Subject: Re: [boost] [General] A standard idiom or technique?
From: Stjepan Rajko (stipe_at_[hidden])
Date: 2008-10-24 04:59:02


On Fri, Oct 24, 2008 at 1:32 AM, Robert Jones <robertgbjones_at_[hidden]> wrote:
>
> void f( int, int );
>
> vector<int> v1;
> vector<int> v2;
>
> // populate...
>
> for ( unsigned i = 0; i <= v1.size( ); ++ i )
> {
> f( v1[ i ], v2[ i ] );
> }
>
> How would you write this as a for_each() or in some other Boosty, functional
> way?

The following page seems to have a related example:
http://www.boost.org/doc/libs/1_36_0/libs/iterator/doc/zip_iterator.html

Is that what you were looking for?

Stjepan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk