From: rogeeff (rogeeff_at_[hidden])
Date: 2002-01-29 13:05:44
--- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
> ----- Original Message -----
> From: <nbecker_at_f...>
> > David> You can adapt anything; it doesn't have to be an
> iterator has
> > David> some state data, right? Just adapt that.
> > Depends what you mean by "adapt". If by "adapt x" you mean "x is
> > first parameter to iterator_adaptor"
> > , then I believe x has to be an
> > iterator. You can't directly adapt a container, for example.
> > adapt the container's iterator.
> Trust me, you can. I co-wrote the library, I should know ;^)
> > I guess if you want to adapt the container, you have to do it in 2
> > steps. First adapt the container's iterator, then make an object
> > uses that adapted iterator.
> Not neccessarily.
> An example of a non-iterator being adapted is
> Ints look enough like iterators that this is maybe not such a good
> but you could put any kind of data at all in there. Using an
> gets you more convenient defaults for the associated types and
> behaviors from default_iterator_policies.
> For your circular buffer, you'd probably want to use the underlying
> type as the first parameter, and store the buffer limits in the
I have implemented class cycle_iterator based on on
iterator_adaptors. It is generic class that will work with any
collection. If it sound interesting I could post the code.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk