Homework/HW02/List.cc
bool List::removeNodeAfter(ListIterator iter)
{
    if (!iter) // current in iter is NULL
        return removeFront();
    else 
    {
        if (!iter.current->next) // iter is the last node
            return false; // nothing to remove in this case
        else
        {
            ListNodePtr temp = iter.current->next; // the node to delete
            iter.current->next = iter.current->next->next; // adjust links
            delete temp;
            size--;
            if (!iter.current->next) // if the node we deleted was the last one
                tail = iter.current; // then we have a new tail.
            return true;
        }
    }
}
// Removes the node in the list after the one pointed to by the
// current in the iterator. If the iterator contains a NULL pointer,
// it removes the front node. It returns false if the list was empty
// and no node was removed.
Removes the node in the list after the one pointed to by the
current in the iterator. If the iterator contains a NULL pointer,
it removes the front node. It returns false if the list was empty
and no node was removed.
Removes the node in the list after the one pointed to by the current in the iterator . If the iterator contains a NULL pointer it removes the front node . It returns false if the list was empty and no node was removed .
bool List::removeNodeAfter(ListIterator iter)
{
    if (!iter) 
        return removeFront();
    else 
    {
        if (!iter.current->next) 
            return false; 
        else
        {
            ListNodePtr temp = iter.current->next; 
            iter.current->next = iter.current->next->next; 
            delete temp;
            size--;
            if (!iter.current->next) 
                tail = iter.current; 
            return true;
        }
    }
}
bool List :: removeNodeAfter ( ListIterator iter ) { if ( ! iter ) return removeFront ( ) ; else { if ( ! iter . current -> next ) return false ; else { ListNodePtr temp = iter . current -> next ; iter . current -> next = iter . current -> next -> next ; delete temp ; size -- ; if ( ! iter . current -> next ) tail = iter . current ; return true ; } } }
Removes the node in the list after the one pointed to by the
current in the iterator.
Removes the node in the list after the one pointed to by the current in the iterator .
// current in iter is NULL // iter is the last node // nothing to remove in this case // the node to delete // adjust links // if the node we deleted was the last one // then we have a new tail.