Boost logo

Boost :

From: michel.andre_at_[hidden]
Date: 2001-10-02 15:37:24


> template <class Difference, class BaseType1, class BaseType2>
> Difference distance(type<Difference>, const BaseType1& x, const
> BaseType2& y) const {}
>
> As I understand it, the "BaseType1/2" is misleading, because the
> parameter is not the base iterator, it's the adapted iterator. Do I
> understand correctly? I hope so, because it would be impossible to
> make this work for adaptors that have internal state otherwise.

It seems from the source code that it is the Base or underlying
iterator thats sent into to the policy class.

I'm wrestling with a similar problem and the iterator_adaptors i want
to keep all state in the "begin()" iterator and have the "end()" with
just a flag saying endIterator and this means to be able to determine
equality i need the policy objects for both rhs and lhs in the equal
method of the policy class.

template <class Iterator1, class Iterator2>
    bool equal(const Iterator1& x, const Iterator2& y) const

The reason for my design is that the iterator generated by begin
contains both the start and the end of the iteration and in some
cases even a pointer to the container of the elements to iterate over.

Is there some solution to this problem? Or do i have to "adapt" the
base iterator with my state (using eg inheritance) and then use the
iterator_adapter to adapt my "adaption" to get it to work?

/Michel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk