Boost logo

Boost Users :

Subject: Re: [Boost-users] [Range] Strange!
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2014-08-28 17:41:47


On 28 August 2014 22:22, Neil Groves <neil_at_[hidden]> wrote:

> The counting_range instance is a unnamed temporary, since the adaptors are
> applied to this temporary the adapted iterators may live beyond the
> lifetime of the source. If you where to add the line:
>
> const auto& rng = counting_range(1, 5)
>
> and then you did:
> print_it(rng | reversed | transformed(bind(doubled, _1)));
>
> it should then work since there are no issues with chaining the adaptors
> since the iterators are always copied from the base range instances during
> the chaining process. One has to manage the lifetime of the source to
> ensure it lives beyond the lifetime of the iterators.
>
>
Actually that doesn't work, makes no difference!

- Rob.



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