Boost logo

Boost Users :

Subject: Re: [Boost-users] [Range] Range adaptors and compatibility with non-adapted iterators
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2012-01-12 03:39:21


On 1/11/2012 4:11 AM, Szymon Gatner wrote:

>
> Adapted iterators have base() method that returns underlying iterator. For every
> level of adaptation just call base() on resulting iterator to get to
> the base one.
>

Hmm, I think that is making use of implementation-specific details that are documented as
off-limits. The docs say that the return type of operator| is unspecified. If you happen
to know that it's really built using Boost iterator facade and Boost iterator adaptors,
sure you can use the features of those.

Now the iterators made using the adaptors library have various features: (1) essential
features needed by something that works as an adapted iterator; (2) gee-wiz extra features
beyond that; (3) incidentals due to the particular implementation.

Since the iterator on an adapted range is logically an adapted iterator in principle, it
makes sense that the "essential features" would be the same. That is, the implementation
could promise the features in (1) above without breaking the abstraction or getting
cornered if the implementation changes, or when migrating to a similar feature that is
part of a future standard range library.

Looking at the Iterators library, it seems that the iterator_adaptor does have a base()
member but the iterator_facade does not.


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