Boost logo

Boost-Commit :

From: pdimov_at_[hidden]
Date: 2008-05-13 20:21:29


Author: pdimov
Date: 2008-05-13 20:21:28 EDT (Tue, 13 May 2008)
New Revision: 45347
URL: http://svn.boost.org/trac/boost/changeset/45347

Log:
Updated Borland workaround to properly use BOOST_NO_MEMBER_TEMPLATE_FRIENDS.
Text files modified:
   trunk/boost/enable_shared_from_this.hpp | 17 ++++++++++++-----
   1 files changed, 12 insertions(+), 5 deletions(-)

Modified: trunk/boost/enable_shared_from_this.hpp
==============================================================================
--- trunk/boost/enable_shared_from_this.hpp (original)
+++ trunk/boost/enable_shared_from_this.hpp 2008-05-13 20:21:28 EDT (Tue, 13 May 2008)
@@ -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<Y> * ptr, enable_shared_from_this<T> const * pe );
 template< class T, class Y > void sp_accept_owner( shared_ptr<Y> * ptr, enable_shared_from_this<T> const * pe, void * /*pd*/ );
 
+#endif
+
 template< class T > class enable_shared_from_this
 {
 protected:
@@ -78,7 +82,12 @@
         }
     }
 
-#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<Y> * ptr, enable_shared_from_this<U> const * pe );
+ template< class U, class Y > friend void sp_accept_owner( shared_ptr<Y> * ptr, enable_shared_from_this<U> const * pe, void * /*pd*/ );
+
+#else
 
 public:
 
@@ -90,7 +99,8 @@
         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<detail::sp_deleter_wrapper>( _shared_count );
@@ -101,9 +111,6 @@
             detail::shared_count().swap( _shared_count );
         }
     }
-
- template< class U, class Y > friend void sp_accept_owner( shared_ptr<Y> * ptr, enable_shared_from_this<U> const * pe );
- template< class U, class Y > friend void sp_accept_owner( shared_ptr<Y> * ptr, enable_shared_from_this<U> const * pe, void * /*pd*/ );
 };
 
 template< class T, class Y > inline void sp_accept_owner( shared_ptr<Y> * ptr, enable_shared_from_this<T> const * pe )


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk