Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-06-11 22:30:59


David Abrahams writes:
> Which version is "your version"?

I use a class called iterator_adaptor in MTL that does the same sort
of thing. I'd show it to you except for that I'm too embarrassed by
how broken it is ;)

>
> > Ok, so assuming we can work around
> > the friend function instantiation problem...
>
> That's a big assumption.
>
> > I'm wondering if we can
> > make the implementation of reverse_iterator even smaller. Can we use
> > b&n to also get rid of the operator+=, etc.?
>
> What do you have in mind? I confess to being a bit lost.

I mean would it be possible to remove the operator++, --, +=, and -=
from the reverse_iterator class and have it inherit those operators.
It seems to me all I should really have to do is write out the policy
functions and have the rest taken care of by the wrap_iterator.

template <class Iterator, class NonconstIterator = Iterator, class Traits = std::iterator_traits<Iterator> >
class reverse_iterator
    [...]
    Self& operator++() {
        Base::operator++();
        return *this;
    }
    [...]
};

Cheers,

Jeremy


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