"Daniel Lidström"
Hello,
I want to use the shared_ptr with objects that are allocated using a factory. The problem is the deallocation. It has to be done with a ``manager'' class. For example, here is how the allocation and deallocation has to be done:
PxyFileData& geo_file = dynamic_cast
(fileMan.New("geo")); fileMan.Close(geo_file); I would like to be able to put shared_ptr<PxyFileData>'s into a std::vector and then forget about the deallocation. I.e. fileMan.Close(...) should be done automatically when the objects aren't needed anymore. But since the deallocation isn't simply delete, how can I do this?
Thanks!
-- Daniel SBG AB
If fileMan.Close received pointers, you could do the following:
shared_ptr<PxyFileData> ptr(
&geo_file
, boost::bind(
boost::mem_fn(&