From: Gavin Lambert (boost_at_[hidden])
Date: 2020-05-25 03:37:37
On 22/05/2020 10:17, Andrey Semashev wrote:
> Some time ago I have proposed to include ring_queue and small_ring_queue
> containers to Boost.Container:
> The ring queues work similarly to std::queue with the main difference
> being that they use a ring buffer internally to store elements. The
> small_ring_queue also allows to allocate a static storage for a fixed
> amount of elements. The benefit of this is that dynamic memory
> allocations can be practically avoided when the number of enqueued
> elements does not exceed some limit.
Boost.Lockfree  already contains such a queue (which operates similar
to a ring-buffer when set to fixed capacity, but can be configured to be
The queue doesn't implement a ring buffer, but can be used as if it did.
The spsc_queue actually uses a ring buffer internally.
They implement "push fails" if the buffer is full when fixed-capacity,
but (provided you use the multi-consumer version, or prevent concurrent
access some other way) there's no reason why you couldn't pop and retry
if you want overwrite-like behaviour.
Usually I personally find that if I care about memory allocation then I
care about locking as well.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk