Subject: Re: [boost] [pool] Objects of varying sizes
From: Robert Dailey (rcdailey.lists_at_[hidden])
Date: 2012-06-26 12:19:24
On Mon, Jun 25, 2012 at 6:48 PM, Klaim - Joël Lamotte <mjklaim_at_[hidden]>wrote:
> don't look at the object_pool, look at pool. It provide only allocation and
> destruction methods, given a size at runtime.
> That way you can wrap it with a template function that give the size of the
> object you want to create to the pool for it to allocate memory for you.
Thanks for the response. I am reviewing the boost.pool reference here:
Based on that, I do not see a way to allocate blocks of varying sizes. The
documentation makes it sound like I have to set size_type to the largest
object that will be allocated, which I have no reasonable way of knowing (I
have hundreds of objects in my inheritance hierarchy, each with varying
size, and no way to calculate the largest in a maintainable way).
The malloc() method does not take any parameters.
Am I misunderstanding you? Could you please point me in the right
direction? Thanks again for your help.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk