Changed move constructors/assignments to leave the source empty

[SVN r37439]
This commit is contained in:
Peter Dimov
2007-04-15 02:47:45 +00:00
parent 66a25bd4a9
commit 86d3f0aba7

View File

@@ -313,26 +313,26 @@ public:
shared_ptr( shared_ptr && r ): px( r.px ), pn() // never throws shared_ptr( shared_ptr && r ): px( r.px ), pn() // never throws
{ {
pn.swap( r.pn ); pn.swap( r.pn );
r.px = 0;
} }
template<class Y> template<class Y>
shared_ptr( shared_ptr<Y> && r ): px( r.px ), pn() // never throws shared_ptr( shared_ptr<Y> && r ): px( r.px ), pn() // never throws
{ {
pn.swap( r.pn ); pn.swap( r.pn );
r.px = 0;
} }
shared_ptr & operator=( shared_ptr && r ) // never throws shared_ptr & operator=( shared_ptr && r ) // never throws
{ {
px = r.px; this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
pn.swap( r.pn );
return *this; return *this;
} }
template<class Y> template<class Y>
shared_ptr & operator=( shared_ptr<Y> && r ) // never throws shared_ptr & operator=( shared_ptr<Y> && r ) // never throws
{ {
px = r.px; this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
pn.swap( r.pn );
return *this; return *this;
} }