On 28 August 2014 22:22, Neil Groves <neil@grovescomputing.com> 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.