Boost logo

Boost :

From: Bo Persson (bop2_at_[hidden])
Date: 2003-06-09 09:08:06


"Nigel Stewart" <nigels_at_[hidden]> skrev i meddelandet
news:bc1ntm$c5f$1_at_main.gmane.org...
> >> 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
bop2_at_[hidden]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk