
On Tue, Jun 26, 2012 at 12:48 PM, Cory Nelson <phrosty@gmail.com> wrote:
On Fri, May 4, 2012 at 2:14 PM, Robert Dailey <rcdailey.lists@gmail.com
wrote:
Is it possible to create a pool for polymorphic types? For example:
class A;
class B : public A; class C : public A;
I want to create a pool of type A, but the allocation can be for B or C at any time. Will this work?
For performance reasons, you'll only be able to allocate objects of a fixed size. You might try a pool of variant<B,C> instead.
For a variable-sized pool, as an implementation detail most runtime environments do implement a variable-sized pool behind the scenes for malloc/new.
So are you saying it isn't beneficial or practical to use boost::pool to allocate chunks of varying sizes, and that the Windows Memory Manager is better suited?