fixed bug in CList::put
This commit is contained in:
parent
ab6909a60c
commit
8dceb45567
|
@ -252,18 +252,20 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// puts an element after where
|
// puts an element after where
|
||||||
// sets where to point to the new element
|
// alters where to point to the new element
|
||||||
// returns an iterator pointing to the new element
|
// returns an iterator pointing to the new element
|
||||||
iterator put(T *pObj, iterator where)
|
iterator put(T *pObj, iterator &where)
|
||||||
{
|
{
|
||||||
CElement *pTmp = new CElement(pObj);
|
CElement *pTmp = new CElement(pObj);
|
||||||
if (where.m_pNext)
|
if (where.m_CurPos->GetNext())
|
||||||
where.m_pNext->m_pPrev = pTmp;
|
where.m_CurPos->GetNext()->SetPrev(pTmp);
|
||||||
else // where = tail
|
else // where = tail
|
||||||
m_pTail = pObj;
|
m_pTail = pTmp;
|
||||||
where.m_pNext = pTmp;
|
|
||||||
pTmp->SetPrev(where.m_CurPos);
|
pTmp->SetPrev(where.m_CurPos);
|
||||||
pTmp->SetNext(where.m_pNext->m_CurPos);
|
pTmp->SetNext(where.m_CurPos->GetNext());
|
||||||
|
|
||||||
|
where.m_CurPos->SetNext(pTmp);
|
||||||
return ++where;
|
return ++where;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user