
Since the deleter is parameterized, why space optimization be a concern.
I've never tried using a functor as a deleter, but I don't see why it
wouldn't work. If it was only a free function that would work, I don't
think they would need the parameterized type D.
Have you tried removing the boost::mem_fun part? I think the shared_ptr
constructor might not be able to deduce the return type of the member
function correctly. I'm basing my comment on this documentation:
http://www.boost.org/doc/libs/1_40_0/libs/bind/bind.html#with_member_pointer...
On Sat, Oct 10, 2009 at 3:13 AM, Alex MDC
2009/10/10 Ryan McConnehey
I have a class that provides a shared_ptr number. At the end of the number's life cycle it should be placed back on a list of available numbers. The shared_ptr's custom deleter function looks like what I need. I'm able to get a free function to compile as the deleter just fine. In trying to use a class member function as the custom deleter I've run into compile errors. I'm not sure where I'm going wrong. I know the custom deleter need to be copy constructible and I'm probably breaking some assumed requirement. Any help on what I'm doing wrong would be appreciated. Ryan
I'm pretty sure you can't provide a functor as the custom deleter, only a free function. Probably due to space efficiency within the shared_ptr blob (4 byte pointer vs ~32 bytes for a boost::function).
Alex
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users