LinkedList: Fixed some boogs, LinkedList is now boog-free :)
This commit is contained in:
parent
1c70ab5a1a
commit
2af3997456
@ -49,12 +49,14 @@ template <typename T> class LinkedListNode
|
|||||||
{
|
{
|
||||||
end_node->m_next_node = this;
|
end_node->m_next_node = this;
|
||||||
this->m_last_node = end_node;
|
this->m_last_node = end_node;
|
||||||
|
this->m_next_node = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepend_to_list(SelfType* start_node)
|
void prepend_to_list(SelfType* start_node)
|
||||||
{
|
{
|
||||||
start_node->m_last_node = this;
|
start_node->m_last_node = this;
|
||||||
this->m_next_node = start_node;
|
this->m_next_node = start_node;
|
||||||
|
this->m_last_node = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
friend class LinkedList<T>;
|
friend class LinkedList<T>;
|
||||||
@ -104,6 +106,8 @@ template <typename T> class LinkedList
|
|||||||
|
|
||||||
if (m_end_node == base_node) m_end_node = new_node;
|
if (m_end_node == base_node) m_end_node = new_node;
|
||||||
|
|
||||||
|
if (base_node->get_next()) base_node->get_next()->set_last(new_node);
|
||||||
|
|
||||||
new_node->set_next(base_node->get_next());
|
new_node->set_next(base_node->get_next());
|
||||||
base_node->set_next(new_node);
|
base_node->set_next(new_node);
|
||||||
new_node->set_last(base_node);
|
new_node->set_last(base_node);
|
||||||
|
Loading…
Reference in New Issue
Block a user