
1 Apr
2006
1 Apr
'06
6:27 p.m.
On 4/1/06, Marco Correia
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);
Just to point out, you probably want to use your allocator's construct and destroy methods too.
I've asked in boost irc channel, and someone told me ptr_* boost libraries solve this problem, is this correct?
I don't think that the ptr_ ones will, but shared_ptr allows you to specify a custom deleter at construction, which seems to be to be just what you need. ~ Scott