18 Aug
2008
18 Aug
'08
8:29 p.m.
Alejandro Martinez:
can i use some class's (a kind of factory) member be used as a deallocator in a shared_ptr?
like to do something like this:
boost::shared_ptrmysqlpp::Connection cp(sDbPool->grab(), boost::bind(&mysqlpp::ConnectionPool::release, sDbPool));
where sDbPool is a shared_ptr to the "factory/pool manager".
Assuming void ConnectionPool::release( Connection * pc ); try boost::bind( &ConnectionPool::release, sDbPool, _1 ); shared_ptr passes the raw pointer to its deleter, and the _1 passes it as the 'pc' parameter of 'release'. sDbPool is the implicit 'this'.