On 2020-05-22 17:31, Mathias Gaunard wrote:
On Fri, 22 May 2020 at 15:08, Andrey Semashev via Boost
wrote: However, std::deque continues to dynamically allocate chunks as you push and pop elements, even if the average number of enqueued elements stays the same. This is avoided by ring queues.
Nothing prevents you from using a pool allocator with a deque.
I agree with Peter in that it is a much more complicated solution. It is likely much less efficient, too. For example, such an allocator has to be prepared that it will be used to allocate buffers of different types and sizes, so it will be difficult to predict, which allocations need to be pooled and which are not. Then the complications from allocator propagation, rebinding, conversion and comparison. It is easier to implement a new container than a non-trivial allocator, really.