void LinkedList::Remove(void* item)
{
	if (frontNode)
	{
		ListNode* currNode = frontNode;
		do
		{
			if (currNode->GetItem() == item)
			{
				break;
			}
			currNode = currNode->GetNext();
		} while (currNode);
		if (currNode)
		{
			delete currNode;
			numItems--;
			if (numItems == 0)
			{
				frontNode = NULL;
				backNode = NULL;
			}
		}
	}
}
Example #2
0
    template <class Type> Type List<Type>::GetAt(LISTNODE pNode)
    {
        ListNode<Type>                *pListNode = (ListNode<Type> *)pNode;

        // Faults if you pass NULL
        _ASSERTE(pNode);

        return pListNode->GetItem();
    }
Example #3
0
    template <class Type> Type List<Type>::GetNext(LISTNODE &pNode)
    {
        ListNode<Type> *pListNode = (ListNode<Type> *)pNode;

        // Faults if you pass NULL
        _ASSERTE(pNode);

        Type item = pListNode->GetItem();
        pNode = (LISTNODE)(pListNode->GetNext());

        return item;
    }