Boost logo

Boost Users :

From: Marco Correia (mvc_at_[hidden])
Date: 2006-04-01 11:04:32


Hi,

I have an heterogeneous container holding pointers to objects of type B. I
want to insert objects of type D1,D2,... that derive from B, and I want to do
that using a custom stl like allocator, for example:

B* obj = my_alloc<D>::allocate(1);
obj = new (obj) B();
container.insert(obj);

My problem is that when an object is removed from the container, I have to
explicitely deallocate it from my allocator, but the static info was lost, so
I cannot do

my_alloc<?>::deallocate(1,oj);

I've asked in boost irc channel, and someone told me ptr_* boost libraries
solve this problem, is this correct?

thanks

-- 
Marco Correia <mvc_at_[hidden]>

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