Boost logo

Boost Users :

From: Travis Parks (jehugaleahsa_at_[hidden])
Date: 2006-12-02 10:12:40


Thanks, I will look into it. Your help is really appreciated.

On 12/2/06, Peter Dimov <pdimov_at_[hidden]> wrote:
> Travis Parks wrote:
> > Hello:
> > I just started using some boost today. I am trying to use a non-static
> > member function as the deleter in a shared_ptr. I was looking at the
> > source code and I don't think it is supported. This is what I had:
> >
> >
> > shared_ptr<Environment> environment(Environment::createEnvironment(),
> > Environment::terminateEnvironment);
> > string userName = "monkey_bottoms";
> > string password = "blahblahblah"
> > shared_ptr<Connection> connection(
> > environment->createConnection(
> > userName,
> > password),
> > &Environment::terminateConnection);
> >
> > This didn't work at all!
>
> Use boost::bind( &Environment::terminateConnection, environment, _1 ) as a
> deleter.
>
> If for some reason you don't want connections to keep a shared_ptr to the
> environment and prevent its deletion, you can use boost::bind(
> &Environment::terminateConnection, environment.get(), _1 ).
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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