|
Boost : |
From: Nigel Stewart (nigels_at_[hidden])
Date: 2003-06-06 10:30:38
Jan,
I'm looking forward to the opportunity of having a close look
at your cyclic_buffer. But for now, a few perhaps shallow
comments...
1. How about push_front()? (in std::list style)
And pop_front()?
For the sake of generality.
The vague concept I have in mind is some kind
of sliding window algorithm that could be moving
either left or right, using a circular buffer as
a cache. (Currently pondering a 2D version of a
circular buffer, anyone come across such a beast?)
2. How about reserve(..) and resize(..)?
Shouldn't change_capacity be called reserve, like vector?
Shouldn't max_size be called capacity, like vector?
One context I which I've made happy use of a circular
buffer is for storing history in the form of a 3D
trail for moving particles. It's handy to allow the
GUI to adjust the size of trails dynamically.
Semantics of resize should probably follow vector:
1. The capacity is implicitly adjusted to fit the
requested size. (Optional to explicitly manage
capacity in addition to size)
2. Items are lost from the end if the container is
to be shrunk.
(Oops, just noticed that resize is in one part of
the documentation, but not the non-doxygen page).
For your reference, my somewhat more modest circular buffer:
http://www.nigels.com/glt/doc/classcbuffer.html
I am new to boost, but liking it very, very much...
Cheers,
Nigel Stewart
> The cyclic buffer implementation and documentation (cyclic_buffer.zip) can be
> found at:
> http://groups.yahoo.com/group/boost/files/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk