From: gchen (chengang31_at_[hidden])
Date: 2007-01-24 16:46:37
Steven Watanabe wrote:
> gchen wrote:
>> Michael Marcin wrote:
>>>> It seems like there should be a better way of doing this... i.e.
>>>> void DestroyAllObjects()
>>>> 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?
>> It seems that pool::release_memory or purge_memory can do this.
> 1) They don't call the destructors.
> 2) object_pool does not expose these members.
You are right. Now I remember someone asked why object_pool does not
And I have thought about such problem before, maybe a solution is
to make object_pool dynamic alloced, when we need destroy all objects,
we can simply delete the object_pool itself. like this:
// create m_object_pool somewhere
// destroy object_pool itself to destroy all objects
// re-create the object_pool if needed.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk