Boost logo

Boost Users :

Subject: Re: [Boost-users] chaining ouput iterator to input iterator
From: MM (finjulhich_at_[hidden])
Date: 2012-07-09 15:14:21


> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Nathan Ridge
> Sent: 09 July 2012 19:20
> To: Boost Mailing List
> Subject: Re: [Boost-users] chaining ouput iterator to input iterator
>
>
> > > >> your options are ... 2) use a Boost.Context-based solution as I
> > > >> mentioned before.
> > >
> > > > Boost.Coroutine? Is that in boost vault?
> >
> > [snip]
> >
> > Frankly, the coroutine seems very unnatural as I am accustomed to the
> > separation of concerns, and the mechanism of of function call, and so
> on...
> >
> > I was also wondering if some lazy function from phoenix could help
> with
> > this, or really a boost::transform_iterator could do it somehow
>
> Is it possible for you to change the implementation of my_transform? If
> so,
> could you post its implementation (or an outline of it)? We may be able
> to
> suggest a way to express the same thing with boost::transform_iterator
> instead.
>
> Regards,
> Nate
>
I wouldn't be able to change the signature...

template <typename InputIterator, typename OutputIterator>
void ratios( InputIterator begin, InputIterator end, OutputIterator out )
{
  auto i=begin; ++i;
  auto prev=begin;
  while (i!=end) {
    *out = (*i)/(*prev);
    ++out; ++i; ++prev;
  }
}

MM


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