forked from boostorg/smart_ptr
Optimize make_local_shared to use a single allocation
This commit is contained in:
@@ -61,6 +61,28 @@ int main()
|
||||
|
||||
BOOST_TEST( X::instances == 0 );
|
||||
|
||||
{
|
||||
boost::shared_ptr< X > px = boost::make_shared_noinit< X >();
|
||||
BOOST_TEST( X::instances == 1 );
|
||||
|
||||
try
|
||||
{
|
||||
boost::shared_ptr< X > qx = px->shared_from_this();
|
||||
|
||||
BOOST_TEST( px == qx );
|
||||
BOOST_TEST( !( px < qx ) && !( qx < px ) );
|
||||
|
||||
px.reset();
|
||||
BOOST_TEST( X::instances == 1 );
|
||||
}
|
||||
catch( boost::bad_weak_ptr const& )
|
||||
{
|
||||
BOOST_ERROR( "px->shared_from_this() failed" );
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_TEST( X::instances == 0 );
|
||||
|
||||
{
|
||||
boost::shared_ptr< X > px = boost::make_shared< X >( 1 );
|
||||
BOOST_TEST( X::instances == 1 );
|
||||
|
||||
Reference in New Issue
Block a user