"Nigel Stewart" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> >>  So the issue here seems to be whether a cyclic_buffer
> >>  should be circular-list-like or FIFO-like.
> >
> > I designed the cyclic_buffer mainly for adding the elements at the
end of the
> > container and automatic removal of elements from the beginning -
it is just plain
> > FIFO, nothing else.
>
> (Please excuse the tone here if it sounds too officious,
> just intending to be precise...)
>
> Therefore, here is the case for extending the proposed
> cyclic_buffer:
>
> - Rename to circular_buffer

This could be another type of container!  :-)

Instead of dropping elements when the buffer is full, we might also
consider waiting or throwing a failure.

>
> Relate the container more closely to the concept of
> a circular list.  The proposed cyclic_buffer appears
> to support a subset of circular_buffer interface
> and functionality.
>
> - Add push_front() and pop_front()
>
> For the purpose of generality, allow manipulation of
> the container at both ends of the buffer, rather than
> pushing to the back and popping from the front.


Could make it too general!

A buffer where you add elements at one end and remove  them from the
other can have interesting multi-threading semantics if you have
exactly one producer and one consumer. If you can store the end
pointers atomically, you might not need any locks!



Bo Persson
[EMAIL PROTECTED]


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to