On Wed, Feb 18, 2009 at 8:54 PM, Scott McMurray <me22.ca+boost@gmail.com> wrote:
Yes, you will. (I had thought you were popping tasks off the vectors
to run them.) And be sure to keep the capacity and size of the
circular_buffer the same, or else the rotate will start copying and
destructing vectors.
Well after I construct my circular buffer, I immediately do:
schedule.resize( 100 );
This should give it a fixed size, right? And as long as I never call any of the pop or push functions to remove/add elements, nothing should be allocated or freed by the circular buffer, correct again?
Of course, even on other containers you always have the option of
c.push_back(vector<T>());
swap(c.front(), c.back());
c.pop_front();
which should also avoid any allocing or freeing by the vectors.
I'm assuming "c" here is the circular buffer previously named "schedule"?
Won't doing a push_back() and pop_front() cause an allocation and deallocation, respectively? the rotate() looked good because it did not actually add or move anything from the circular buffer itself.