mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-31 13:17:23 +02:00
Changed move constructors/assignments to leave the source empty
[SVN r37439]
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user