Need help with simple linked list
Hi, I'm trying to transform a double linked list into a simple linked list. For that I need to change how the functions work and I'm having trouble with Insert().
The problem is that I do not have access to pPrev pointer anymore but I still need to know where the previous node is.
So if anyone have any idea on how to do this, help would be appreciated.
ClIterator Insert(ClIterator p_position, const T& p_data)
if (++m_nbNode== 1)
m_pHead= m_pTail= new TypeNode(p_data, 0);
TypeNode* pPosition= p_position.m_pNode;
if (pPosition == 0)
m_pTail= new TypeNode(p_data, m_pTail, 0);
if (pPosition == m_pHead)
m_pHead= new TypeNode(p_data, 0, m_pHead);
TypeNode* p= new TypeNode(p_data, pPosition->pPrev, pPosition);
p->pNext->pPrev= p->pPrev->pNext= p;