Arno Schödl | 1 Sep 13:56
Favicon

Re: lifetime of ranges vs. iterators

> >
> > You need to be able to take two adapted iterators and turn them into a
> > range.  Do you want that range to contain redundant data?  I don't.

> Hei, maybe this is all that we need! Let's have a metafunction that
> given an iterator type returns its preferred range type (the
> associated range). The default might be boost.range or even std::pair.
>  The developer of an iterator adaptor, can specialize the metafunction
> so that the associate range is the optimum representation for an
> iterator pair.

> Do you think this would be enough? It seems too simple to me, so
> probably I'm missing something...

I wouldn't know what to do when my iterator_adaptor needs three iterators to the same range. I could store
two efficiently as a range and retrieve them when needed by querying range::begin()/end(), but what do I
do with the third? Dave's factored iterators go further in the same direction, basically dropping the
requirement that the common data must be a range, it can be anything. 

Both proposals have the disadvantage that I need to wrap/unwrap the [common data (Dave)/range
(Giovanni)] whenever I change one of the wrapped iterators. I'd rather store the common data explicitly,
and have indirections inside the iterators that point to it.

Correct me if I misunderstand one of the two proposals.

Arno

--
Dr. Arno Schoedl · aschoedl <at> think-cell.com 
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Gmane