diff --git a/include/boost/enable_shared_from_this.hpp b/include/boost/enable_shared_from_this.hpp index 10accd6..b624ee9 100644 --- a/include/boost/enable_shared_from_this.hpp +++ b/include/boost/enable_shared_from_this.hpp @@ -21,10 +21,14 @@ namespace boost { +#if !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) + template< class T > class enable_shared_from_this; template< class T, class Y > void sp_accept_owner( shared_ptr * ptr, enable_shared_from_this const * pe ); template< class T, class Y > void sp_accept_owner( shared_ptr * ptr, enable_shared_from_this const * pe, void * /*pd*/ ); +#endif + template< class T > class enable_shared_from_this { protected: @@ -78,7 +82,12 @@ private: } } -#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, <= 0x551 ) +#if !defined( BOOST_NO_MEMBER_TEMPLATE_FRIENDS ) + + template< class U, class Y > friend void sp_accept_owner( shared_ptr * ptr, enable_shared_from_this const * pe ); + template< class U, class Y > friend void sp_accept_owner( shared_ptr * ptr, enable_shared_from_this const * pe, void * /*pd*/ ); + +#else public: @@ -90,7 +99,8 @@ public: if( _weak_count.use_count() == 0 ) { _weak_count = owner.get_shared_count(); - }else if( !_shared_count.empty() ) + } + else if( !_shared_count.empty() ) { BOOST_ASSERT( owner.unique() ); // no weak_ptrs to owner should exist either, but there's no way to check that detail::sp_deleter_wrapper * pd = detail::basic_get_deleter( _shared_count ); @@ -101,9 +111,6 @@ public: detail::shared_count().swap( _shared_count ); } } - - template< class U, class Y > friend void sp_accept_owner( shared_ptr * ptr, enable_shared_from_this const * pe ); - template< class U, class Y > friend void sp_accept_owner( shared_ptr * ptr, enable_shared_from_this const * pe, void * /*pd*/ ); }; template< class T, class Y > inline void sp_accept_owner( shared_ptr * ptr, enable_shared_from_this const * pe )