[pool] object_pool::destroy_all?

I started using object_pool recently to solve a problem. I have lots of objects being created and destroyed frequently and stored in a collection. Every so often an event happens which triggers destroying all the objects. Essentially I have: boost::object_pool<Object> m_object_pool; std::vector<Object*> m_objects; Then I have a function void DestroyAllObjects() { std::vector<Object*>::iterator it, iend = m_objects.end(); for( it = m_objects.begin(); it != iend; ++it ) { m_object_pool.destroy(*it); } m_objects.clear(); } It seems like there should be a better way of doing this... i.e. void DestroyAllObjects() { m_object_pool.destroy_all(); m_objects.clear(); } Also it might be nice to iterate over all the objects in the pool (in which case I wouldn't even need the m_objects vector. Perhaps there is a better way to solve the problem? Thanks, Michael Marcin
participants (1)
-
Michael Marcin