Boost logo

Boost Users :

Subject: Re: [Boost-users] A need for a complex pool type container
From: Robert Dailey (rcdailey_at_[hidden])
Date: 2009-02-18 21:44:00


On Wed, Feb 18, 2009 at 5:16 PM, Scott McMurray <me22.ca+boost_at_[hidden]>wrote:

> Perhaps this?
>
> boost::circular_buffer<vector<T> > schedule(100);
>
> Then you could use
>
> schedule.rotate(schedule.begin()+1);
>
> to move to the next bucket, which should (in steady-state) avoid
> reallocation of the container or the buckets, since you never actually
> destruct or copy the vectors.
>
>
> http://www.boost.org/doc/libs/1_38_0/libs/circular_buffer/doc/circular_buffer.html
>

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.

I appreciate your help!



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net