|
Boost : |
From: David A. Greene (greened_at_[hidden])
Date: 2002-10-28 15:53:44
scleary_at_[hidden] wrote:
> Though I was approaching it from the idea of using Dave Abraham's iterator
> adaptor generator to create an iterator adaptor that would pass the data to
> its base iterator until a certain condition is reached (e.g., after "n" data
> values have been written), and then perform some action if another value is
> written (e.g., do nothing, throw an exception, ...)
>
> This might not fit what you're looking for, but you might want to have a
> look at Boost.IteratorAdaptor to see if it could support your solution...
The problem with iterators is that they are static with respect to the
container. What I need is a real queue with real queue action (i.e.
item insert and removal) but with some bounds on queue size. Unless
the iterator keeps a reference to the container, it can't do this. If
it does keep such a reference, I don't think it's really an iterator
anymore.
> Or maybe not. If you're heading for stack/queue-like adaptors for a
> fixed-size container, you might want to check out some recent posts on this
> list with regard to "circular queues". I didn't follow that discussion
> myself, so I couldn't tell you how it ended up...
Thanks for the reference. I'll have a look.
-Dave
-- "Some little people have music in them, but Fats, he was all music, and you know how big he was." -- James P. Johnson
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk