Boost logo

Boost Users :

Subject: Re: [Boost-users] [shared_ptr] Using a custom delete function that is a class member function
From: Alex MDC (alex.mdc_at_[hidden])
Date: 2009-10-10 03:13:33


2009/10/10 Ryan McConnehey <mccorywork_at_[hidden]>

> 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 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