Boost logo

Boost :

From: Alisdair Meredith (alisdair.meredith_at_[hidden])
Date: 2002-10-01 11:57:33


Jan Gaspar wrote:

> Under the term cyclic buffer I understand a container with a restricted length.
> The elements which will be stored in the cyclic buffer are usually added at the
> end of the container. If the cyclic buffer is full and a new element is added then
> the element at the beginning of the cyclic buffer has to be removed.

I believe there have been several proposals for a cyclic buffer in the
past, all meeting different requirements. Although the concept seems
well defined, I can see a couple of variations that should be selectable
in a final implementation, possibly through some kind of policy
parametrization.

For instance, should items be removed from the buffer, or simply
overwritten?
Can the buffer be 'partially' filled? i.e. until I have written enough
to fill the buffer, is buffer.size() less than buffer.capacity() or is
it full of 'noise'?
If I can partially full the buffer, can I pop elements out of the
buffer?
Is the buffer size fixed at compile time [eg. backed by boost::array] or
can it change at runtime [eg. backed by std::vector]

I have been planning to pull together a more concrete set of
requirements and supply a sample implementation for submission myself,
but planning and actually finding time are two entirely different issues
:¬ ( Much easier to criticise the efforts of others <gdr>

-- 
AlisdairM
Team Thai Kingdom

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