Boost logo

Boost :

From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2020-05-22 11:32:46


On Fri, 22 May 2020, 11:24 Andrey Semashev via Boost, <boost_at_[hidden]>
wrote:

>
> circular_buffer is not a queue. The important difference is that it
> overwrites older elements as you keep pushing new elements into it.
>

That's just the behaviour when you run out of capacity.
Nothing prevents you from checking you're out of capacity and have
different behaviour instead.

As I said, the main advantage is avoiding dynamic memory allocations

You cannot avoid memory allocations if your queue is unbounded.

If pre-allocation of some size is a concern you can just use an adequate
allocator.

For full memory management flexibility one can also build a circular buffer
view on a manually managed contiguous piece of memory.


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