Boost logo

Boost Users :

Subject: Re: [Boost-users] Iterator to wrap around ends of the container. Does it exist?
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2009-07-22 05:59:02


On Wed, 22 Jul 2009 10:45:15 +0100, PB <newbarker_at_[hidden]> wrote:
> Hi,
>
> Just wondered if there was anything in Boost so that when an iterator
> is incremented, if it's at the last element it goes to the begin() of
> the container. And for decrement if at the beginning it would refer to
> one before end(). The sequence would have to be finite, so just
> selecting a different logical begin and end really.
>
> I'm looking to solve this using some kind of new iterator (iterator
> adaptor) rather than a change of container.
>
> If there anything in Boost for this?

Except for the end point, this should be quite trivial to write using
iterator_adapter from Boost.Iterator.

Sebastian


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