Boost logo

Boost :

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. Your
> 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"
> Yes.
> > , then I believe x has to be an
> > iterator. You can't directly adapt a container, for example.
You can
> > 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
iterator just
> 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
> object.

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, gregod at, cpdaniel at, john at