Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51688 - in branches/release: boost/smart_ptr libs/smart_ptr/test
From: pdimov_at_[hidden]
Date: 2009-03-10 14:26:57


Author: pdimov
Date: 2009-03-10 14:26:57 EDT (Tue, 10 Mar 2009)
New Revision: 51688
URL: http://svn.boost.org/trac/boost/changeset/51688

Log:
Merge [51643] to release. Fixes #2813.
Added:
   branches/release/libs/smart_ptr/test/sp_recursive_assign2_rv_test.cpp
      - copied unchanged from r51643, /trunk/libs/smart_ptr/test/sp_recursive_assign2_rv_test.cpp
   branches/release/libs/smart_ptr/test/sp_recursive_assign2_test.cpp
      - copied unchanged from r51643, /trunk/libs/smart_ptr/test/sp_recursive_assign2_test.cpp
   branches/release/libs/smart_ptr/test/sp_recursive_assign_rv_test.cpp
      - copied unchanged from r51643, /trunk/libs/smart_ptr/test/sp_recursive_assign_rv_test.cpp
   branches/release/libs/smart_ptr/test/sp_recursive_assign_test.cpp
      - copied unchanged from r51643, /trunk/libs/smart_ptr/test/sp_recursive_assign_test.cpp
Text files modified:
   branches/release/boost/smart_ptr/shared_ptr.hpp | 27 +++++++++++----------------
   branches/release/libs/smart_ptr/test/Jamfile.v2 | 4 ++++
   2 files changed, 15 insertions(+), 16 deletions(-)

Modified: branches/release/boost/smart_ptr/shared_ptr.hpp
==============================================================================
--- branches/release/boost/smart_ptr/shared_ptr.hpp (original)
+++ branches/release/boost/smart_ptr/shared_ptr.hpp 2009-03-10 14:26:57 EDT (Tue, 10 Mar 2009)
@@ -198,19 +198,7 @@
         boost::detail::sp_enable_shared_from_this( this, p, p );
     }
 
-// generated copy constructor, assignment, destructor are fine...
-
-// except that Borland C++ has a bug, and g++ with -Wsynth warns
-#if defined(__BORLANDC__) || defined(__GNUC__)
-
- shared_ptr & operator=(shared_ptr const & r) // never throws
- {
- px = r.px;
- pn = r.pn; // shared_count::op= doesn't throw
- return *this;
- }
-
-#endif
+// generated copy constructor, destructor are fine
 
     template<class Y>
     explicit shared_ptr(weak_ptr<Y> const & r): pn(r.pn) // may throw
@@ -301,13 +289,20 @@
 
 #endif // BOOST_NO_AUTO_PTR
 
-#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300)
+ // assignment
+
+ shared_ptr & operator=( shared_ptr const & r ) // never throws
+ {
+ this_type(r).swap(*this);
+ return *this;
+ }
+
+#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400)
 
     template<class Y>
     shared_ptr & operator=(shared_ptr<Y> const & r) // never throws
     {
- px = r.px;
- pn = r.pn; // shared_count::op= doesn't throw
+ this_type(r).swap(*this);
         return *this;
     }
 

Modified: branches/release/libs/smart_ptr/test/Jamfile.v2
==============================================================================
--- branches/release/libs/smart_ptr/test/Jamfile.v2 (original)
+++ branches/release/libs/smart_ptr/test/Jamfile.v2 2009-03-10 14:26:57 EDT (Tue, 10 Mar 2009)
@@ -52,5 +52,9 @@
           [ run esft_second_ptr_test.cpp ]
           [ run make_shared_esft_test.cpp ]
           [ run allocate_shared_esft_test.cpp ]
+ [ run sp_recursive_assign_test.cpp ]
+ [ run sp_recursive_assign2_test.cpp ]
+ [ run sp_recursive_assign_rv_test.cpp ]
+ [ run sp_recursive_assign2_rv_test.cpp ]
         ;
 }


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