Yes, if you have a pointer called 'cur' pointing towards the node you want to delete, and a pointer called 'prev' pointing towards the node before the node you want to delete, the code would look something like this:
1 2 3
prev->next = cur->next; // make the previous node point to the next node
delete cur; // delete the node
cur = prev->next; // adjust your cur to point to the the next node
Suppose I have a doubly linked list (so each node has a next AND a prev pointer)....would it still be wise to maintain the prev pointer, along with the curr pointer?
Or would it be more efficient to just use the curr pointer, since the list is now doubly linked?
When deleting a node from a doubly linked list, you have to update both the previous node's forward pointer and the next node's previous pointer, keeping in mind that you could be deleting either the first node in the list, or the last node in the list.
If you look at std::list.erase() as a model, it returns an iterator to the next element, or to end().