Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2020-05-22 10:24:37

On 2020-05-22 13:01, Mathias Gaunard wrote:
> On Thu, 21 May 2020 at 23:17, Andrey Semashev via Boost
> <boost_at_[hidden]> wrote:
>> I would like to ask if there is interest in the community for these
>> kinds of containers. I know I would find them useful, and at least one
>> person commented in the PR to the same effect. However, I would still
>> like to see if more people need this.
> I don't understand the use cases for your container.
> If I want a queue with bounded capacity, I use a circular buffer.

circular_buffer is not a queue. The important difference is that it
overwrites older elements as you keep pushing new elements into it.
std::queue and ring queues instead preserve all pushed elements until
you dequeue them.

> If I want a queue with unbounded capacity, I use std::deque.
> What's the advantage of your approach compared to std::deque? Assuming
> a decent state of the art implementation.

As I said, the main advantage is avoiding dynamic memory allocations,
which you get with std::queue and std::deque. This can be important if
you need a stable latency of push/pop operations or don't want dynamic
memory allocations for other reasons.

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