From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-29 11:52:56
----- Original Message -----
> David> You can adapt anything; it doesn't have to be an iterator. Your
> David> some state data, right? Just adapt that.
> Depends what you mean by "adapt". If by "adapt x" you mean "x is the
> first parameter to iterator_adaptor"
> , 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 that
> uses that adapted iterator.
An example of a non-iterator being adapted is boost::counting_iterator<int>.
Ints look enough like iterators that this is maybe not such a good example,
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 convenient
behaviors from default_iterator_policies.
For your circular buffer, you'd probably want to use the underlying iterator
type as the first parameter, and store the buffer limits in the policies
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk