Boost logo

Boost :

From: Jan Gaspar (jga_at_[hidden])
Date: 2003-06-09 04:40:22

Hi Nigel,

Nigel Stewart wrote:

> So the issue here seems to be whether a cyclic_buffer
> should be circular-list-like or FIFO-like. Given
> that there is already a queue container adapter,
> perhaps it's worth listing some applications
> of cyclic_buffer that depend on either
> circular-list-like or FIFO-like semantics.

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. I don't want to add elements at the beginning. I think it will
be less confusing - just keep it rather simple.

> Could a queue adaptor using a cyclic_buffer instead
> of a deque provide the explicitly FIFO-like mode of
> operation? (While leaving cyclic_buffer to be
> circular-list-like?)

Queue cannot use the cyclic_buffer because the queue's size is not restricted.
Probably I don't understand this question.

> >> Semantics of resize should probably follow vector:
> >> 1. The capacity is implicitly adjusted to fit the
> >> requested size.
> vector::resize
> Inserts or erases elements at the end such that
> the size becomes n.
> (I think a developer may find it surprising for a
> cyclic_buffer::resize to be clamped to the capacity.)

OK, you're right.

Boost list run by bdawes at, gregod at, cpdaniel at, john at