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_;
|
prev_->next_ = next_;
|
||||||
next_->prev_ = prev_;
|
next_->prev_ = prev_;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Swap(RefLinkedBase& rhs)
|
void Swap(RefLinkedBase& rhs)
|
||||||
|
@ -332,12 +333,22 @@ namespace Loki
|
||||||
rhs.Swap(*this);
|
rhs.Swap(*this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::swap(prev_, rhs.prev_);
|
if (next_ == &rhs ) // neighbours
|
||||||
std::swap(next_, rhs.next_);
|
{
|
||||||
std::swap(prev_->next_, rhs.prev_->next_);
|
std::swap(prev_, next_);
|
||||||
std::swap(next_->prev_, rhs.next_->prev_);
|
std::swap(rhs.prev_, rhs.next_);
|
||||||
|
std::swap(rhs.prev_, next_);
|
||||||
assert( next_ == this ? prev_ == this : prev_ != this);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum { destructiveCopy = false };
|
enum { destructiveCopy = false };
|
||||||
|
@ -1245,7 +1256,7 @@ namespace std
|
||||||
// In case that the macro is defined and the conversion policy allow flag is off
|
// 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
|
// (e.g. DisallowConversion) then the conversion from the "pointer" to the
|
||||||
// SmartPtr must be explicit.
|
// SmartPtr must be explicit.
|
||||||
|
// October 32, 2005: fix void Swap(RefLinkedBase& rhs). Peter Kümmel
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#endif // SMARTPTR_INC_
|
#endif // SMARTPTR_INC_
|
||||||
|
|
Loading…
Reference in a new issue