Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-04-26 09:48:04


Daniel Frey:

> I refactored enable_shared_from_this in order to remove the _owner flag.

There's another problem with your new implementation, one that wasn't caught
by esft_regtest (I updated it to catch it):

void test4()
{
    boost::shared_ptr<V> pv( new V );
    boost::shared_ptr<V> pv2( pv.get(), null_deleter() );
}

Your implementation modifies pv2.

This ease with which one might inject subtle failures in remote code (such
as Boost.Python, incidentally) makes me think that sp_accept_owner is a bit
too dangerous. Maybe its shared_ptr argument needs to be made const. This
would break the new constructorful esft though.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk