diff --git a/luna/include/luna/LinkedList.h b/luna/include/luna/LinkedList.h index e6056a19..e5e1e279 100644 --- a/luna/include/luna/LinkedList.h +++ b/luna/include/luna/LinkedList.h @@ -47,6 +47,20 @@ template class DoublyLinkedList m_count++; } + void append_after(T* base, T* ptr) + { + DoublyLinkedListNode* new_node = (DoublyLinkedListNode*)ptr; + DoublyLinkedListNode* base_node = (DoublyLinkedListNode*)base; + + if (m_end_node == base_node) m_end_node = new_node; + + new_node->m_next_node = base_node->m_next_node; + base_node->m_next_node = new_node; + new_node->m_last_node = base_node; + + m_count++; + } + T* remove(T* ptr) { DoublyLinkedListNode* node = (DoublyLinkedListNode*)ptr;