forked from boostorg/smart_ptr
Only use allocator construct/destroy for value_type, not shared_count
This commit is contained in:
@ -249,18 +249,8 @@ public:
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
|
pi_ = a2.allocate( 1 );
|
||||||
|
|
||||||
impl_type * pi = std::allocator_traits<A2>::allocate( a2, 1 );
|
|
||||||
pi_ = pi;
|
|
||||||
std::allocator_traits<A2>::construct( a2, pi, p, d, a );
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
|
|
||||||
::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a );
|
::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a );
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
@ -276,28 +266,11 @@ public:
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
|
pi_ = a2.allocate( 1 );
|
||||||
|
|
||||||
impl_type * pi = std::allocator_traits<A2>::allocate( a2, 1 );
|
|
||||||
pi_ = pi;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( pi_ != 0 )
|
if( pi_ != 0 )
|
||||||
{
|
{
|
||||||
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
|
|
||||||
|
|
||||||
std::allocator_traits<A2>::construct( a2, pi, p, d, a );
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a );
|
::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a );
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -333,18 +306,8 @@ public:
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
|
pi_ = a2.allocate( 1 );
|
||||||
|
|
||||||
impl_type * pi = std::allocator_traits<A2>::allocate( a2, 1 );
|
|
||||||
pi_ = pi;
|
|
||||||
std::allocator_traits<A2>::construct( a2, pi, p, a );
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
|
|
||||||
::new( static_cast< void* >( pi_ ) ) impl_type( p, a );
|
::new( static_cast< void* >( pi_ ) ) impl_type( p, a );
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
@ -360,28 +323,11 @@ public:
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
|
pi_ = a2.allocate( 1 );
|
||||||
|
|
||||||
impl_type * pi = std::allocator_traits<A2>::allocate( a2, 1 );
|
|
||||||
pi_ = pi;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( pi_ != 0 )
|
if( pi_ != 0 )
|
||||||
{
|
{
|
||||||
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
|
|
||||||
|
|
||||||
std::allocator_traits<A2>::construct( a2, pi, p, a );
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
::new( static_cast< void* >( pi_ ) ) impl_type( p, a );
|
::new( static_cast< void* >( pi_ ) ) impl_type( p, a );
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -236,16 +236,8 @@ public:
|
|||||||
|
|
||||||
A2 a2( a_ );
|
A2 a2( a_ );
|
||||||
|
|
||||||
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
|
|
||||||
|
|
||||||
std::allocator_traits<A2>::destroy( a2, this );
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
this->~this_type();
|
this->~this_type();
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
a2.deallocate( this, 1 );
|
a2.deallocate( this, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user