Boost logo

Boost Users :

Subject: [Boost-users] [Ranges] Range adaptors and range lifetimes
From: Álex Puchades (alex94puchades_at_[hidden])
Date: 2016-09-23 18:37:15


Hi boost users!

I'm having some lifetime issues with range adaptors. It seems boost
adaptors (at least, transformed_range) only store iterators from the
original range, letting it go out of scope [1].

Unfortunately, this makes boost adaptors not compatible with ranges that
return iterators that are only valid while the original range is in scope
(ie: any iterator that references the original range).

This type of ranges are useful to avoid the fat-iterator problem, as seen
here [2]. Is there any reason for the current behaviour? Should I file a
bug or has it been discussed before?

Thanks for your help

[1]
https://github.com/boostorg/range/blob/develop/include/boost/range/adaptor/transformed.hpp#L63
[2] http://ericniebler.com/2013/11/07/input-iterators-vs-input-ranges/

-- 
Álex Puchades


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