On 2020-05-22 13:01, Mathias Gaunard wrote:
On Thu, 21 May 2020 at 23:17, Andrey Semashev via Boost
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.