Index: make_shared.hpp =================================================================== --- make_shared.hpp (revision 48913) +++ make_shared.hpp (working copy) @@ -98,12 +98,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T(); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A > boost::shared_ptr< T > allocate_shared( A const & a ) @@ -112,12 +114,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T(); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } #if defined( BOOST_HAS_VARIADIC_TMPL ) && defined( BOOST_HAS_RVALUE_REFS ) @@ -130,12 +134,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( detail::forward( args )... ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A, class... Args > boost::shared_ptr< T > allocate_shared( A const & a, Args && ... args ) @@ -144,12 +150,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( detail::forward( args )... ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } #else @@ -163,12 +171,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A, class A1 > @@ -178,12 +188,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A1, class A2 > @@ -193,12 +205,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A, class A1, class A2 > @@ -208,12 +222,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A1, class A2, class A3 > @@ -223,12 +239,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A, class A1, class A2, class A3 > @@ -238,12 +256,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A1, class A2, class A3, class A4 > @@ -253,12 +273,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3, a4 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A, class A1, class A2, class A3, class A4 > @@ -268,12 +290,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3, a4 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A1, class A2, class A3, class A4, class A5 > @@ -283,12 +307,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3, a4, a5 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A, class A1, class A2, class A3, class A4, class A5 > @@ -298,12 +324,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3, a4, a5 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A1, class A2, class A3, class A4, class A5, class A6 > @@ -313,12 +341,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3, a4, a5, a6 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6 > @@ -328,12 +358,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3, a4, a5, a6 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > @@ -343,12 +375,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3, a4, a5, a6, a7 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > @@ -358,12 +392,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3, a4, a5, a6, a7 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > @@ -373,12 +409,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > @@ -388,12 +426,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > @@ -403,12 +443,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > @@ -418,12 +460,14 @@ detail::sp_ms_deleter< T > * pd = boost::get_deleter< detail::sp_ms_deleter< T > >( pt ); - void * pv = pd->address(); + T * pv = static_cast< T * >(pd->address()); new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); pd->set_initialized(); - return boost::shared_ptr< T >( pt, static_cast< T* >( pv ) ); + boost::shared_ptr< T > p( pt, pv ); + boost::sp_accept_owner( &p, pv ); + return p; } #endif