Note that there are some explanatory texts on larger screens.

plurals
  1. PODoublyLinkedList remove error
    primarykey
    data
    text
    <p>Im making a doublyLinkedList. The error is to do with my Remove method. I cant figure this out. does anyone know?</p> <p>Here is where the error is?</p> <blockquote> <p>Error 1 error C2027: use of undefined type 'DoublyListNode' c:\users\conor\documents\college\c++\projects\repeat - doublylinkedlist\repeat - doublylinkedlist\doublylinkedlist.h 230 1 Repeat - DoublyLinkedList</p> </blockquote> <pre><code>// ------------------------------------------------------------------------------------------------------- // Name: Remove // Description: Removes the node that the iterator points to, moves iterator forward to the next node. // Arguments: p_iterator: The iterator to remove // isForward: Tells which direction the iterator was going through the list // Return Value: None. // ------------------------------------------------------------------------------------------------------- void Remove(DoublyListIterator&lt;Datatype&gt;&amp; m_itr) { DoublyListNode&lt;Datatype&gt;* node = m_head; // if the iteratordoesn’t belong to this list, do nothing. if (m_itr.m_list != this) return; // if node is invalid, do nothing. if (m_itr.m_node == 0) return; if (m_itr.m_node == m_head) { // move the iteratorforward and delete the head. m_itr.Forth(); RemoveHead(); m_size--; } else { // scan forward through the list until you find // the node prior to the node you want to remove while (node-&gt;m_next != m_itr.m_node) node = node-&gt;m_next; // move the iterator forward. m_itr.Forth(); // if the node you are deleting is the tail, // update the tail node. if (node-&gt;m_next == m_tail) { m_tail = node; } // delete the node. delete node-&gt;m_next; // re-link the list. node-&gt;m_next = m_itr.m_node; m_size--; } } </code></pre> <p>If anymore code is needed just ask. I do not want to put lots of code on Stack overflow users.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload