Thanks, I will look into it. Your help is really appreciated.
On 12/2/06, Peter Dimov
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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users