Bugfix: 626407 Assertion with SmartPtr<T, LinkedRef>
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@316 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
cdb722ec38
commit
1d868173c2
1 changed files with 18 additions and 7 deletions
|
@ -308,6 +308,7 @@ namespace Loki
|
|||
prev_->next_ = next_;
|
||||
next_->prev_ = prev_;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
void Swap(RefLinkedBase& rhs)
|
||||
|
@ -332,12 +333,22 @@ namespace Loki
|
|||
rhs.Swap(*this);
|
||||
return;
|
||||
}
|
||||
std::swap(prev_, rhs.prev_);
|
||||
std::swap(next_, rhs.next_);
|
||||
std::swap(prev_->next_, rhs.prev_->next_);
|
||||
std::swap(next_->prev_, rhs.next_->prev_);
|
||||
if (next_ == &rhs ) // neighbours
|
||||
{
|
||||
std::swap(prev_, next_);
|
||||
std::swap(rhs.prev_, rhs.next_);
|
||||
std::swap(rhs.prev_, next_);
|
||||
std::swap(rhs.prev_->next_,next_->prev_);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::swap(prev_, rhs.prev_);
|
||||
std::swap(next_, rhs.next_);
|
||||
std::swap(prev_->next_, rhs.prev_->next_);
|
||||
std::swap(next_->prev_, rhs.next_->prev_);
|
||||
}
|
||||
|
||||
assert( next_ == this ? prev_ == this : prev_ != this);
|
||||
assert( next_ == this ? prev_ == this : prev_ != this);
|
||||
}
|
||||
|
||||
enum { destructiveCopy = false };
|
||||
|
@ -1245,7 +1256,7 @@ namespace std
|
|||
// In case that the macro is defined and the conversion policy allow flag is off
|
||||
// (e.g. DisallowConversion) then the conversion from the "pointer" to the
|
||||
// SmartPtr must be explicit.
|
||||
|
||||
// October 32, 2005: fix void Swap(RefLinkedBase& rhs). Peter Kümmel
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // SMARTPTR_INC_
|
||||
|
|
Loading…
Reference in a new issue