From: Robert Dailey <rcdailey@gmail.com>
To: boost <boost-users@lists.boost.org>
Sent: Saturday, 29 August, 2009
0:17:32
Subject: [Boost-users] circular_buffer: How to make push_back() increase capacity?
Hello,
I have a list of colors that I need to be able to cycle through, either by rotating the container or by using an iterator that will rotate (i.e. return to the beginning when I increment at the end, and vice-versa). The goal is to be able to iterate through the container in a circular way and process all of the colors repeatedly.
I chose a boost::circular_buffer for this job, I assumed it was the perfect tool for the job. It works great, except I would like to be able to call push_back() to add all of my colors to the buffer without having to call set_capacity() on it first. It's a minor thing, but omitting the call to set_capacity() would make it slightly more scalable/manageable since I won't
have to keep incrementing the size of the capacity each time I want to add colors to the buffer.
How can I achieve this?
---------
Robert Dailey