
19 Feb
2009
19 Feb
'09
2:54 a.m.
On Wed, Feb 18, 2009 at 21:44, Robert Dailey <rcdailey@gmail.com> wrote:
Wow, this is actually perfect. So before I do a rotate(), I need to do: schedule[0].clear() right? When I do future push_back operations on schedule[99], I want it to be adding to an empty vector and not adding to the old contents of it.
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. 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.