Boost logo

Boost Users :

Subject: Re: [Boost-users] chaining ouput iterator to input iterator
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-07-07 21:56:27


On Sat, Jul 7, 2012 at 6:55 PM, MM <finjulhich_at_[hidden]> wrote:

> Hi,
>
> I have a function that transforms a serie of numbers into another serie:
>
> template <typename InputIterator, typename OutputIterator>
> void transform( InputIterator begin, InputIterator end, OutputIterator out
> )
> {
> }
>
>
> and a 2nd function that calculates the standard deviation of a sample
>
> template <typename InputIterator >
> double stdev( InputIterator begin, InputIterator end)
> {
> }
>
> Is there a way to chain these existing functions in order to get the std
> dev
> of the transformed serie, without storing the intermediate numbers?
> Maybe with the help of some lazy iterator, or some lazy function?
>

Maybe use boost::transform_iterator?

- Jeff



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