From: Arno Schödl (aschoedl_at_[hidden])
Date: 2008-09-01 04:38:59
> This may lead iterator lifetime problems, not because r iterators may
> be invalid, but because the iterators of the range returned by
> filtered(...) may become invalid as that temporary has been
> I don't see how this happens. The iterators are stored by value in each
> new range that is generated.
Correct, but in the case of difference_range, storing iterators by value leads to 2^N storage bloat when stacking N difference_iterators. You can avoid this with factorable iterators (Dave) or by storing ranges by value and avoiding copying containers either by explicitly wrapping containers as "by ref" (Giovanni) or by range trait (me).
-- Dr. Arno Schoedl · aschoedl_at_[hidden] Technical Director think-cell Software GmbH · Invalidenstr. 34 · 10115 Berlin, Germany http://www.think-cell.com · phone +49-30-666473-10 · toll-free (US) +1-800-891-8091 Directors: Dr. Markus Hannebauer, Dr. Arno Schoedl · Amtsgericht Charlottenburg, HRB 85229
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk