Make LinkedList::prepend() also set the element as the last one if we have no elements
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f5de9c5589
commit
e4b971f09c
@ -85,6 +85,7 @@ template <typename T> class DoublyLinkedList
|
|||||||
void prepend(T* ptr)
|
void prepend(T* ptr)
|
||||||
{
|
{
|
||||||
Node* const node = extract_node(ptr);
|
Node* const node = extract_node(ptr);
|
||||||
|
if (!m_end_node) m_end_node = node;
|
||||||
if (m_start_node) node->prepend_to_list(m_start_node);
|
if (m_start_node) node->prepend_to_list(m_start_node);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user