Update List.hpp

main
p68710245 1 year ago
parent eadc3eba10
commit b1812915b9

@ -41,7 +41,7 @@ template <typename T>
void List<T>::clear()
{
while (head->link)
head->RemoveAfter();
head->remove_after();
tail = head; // 务必注意本类当中的操作是否会影响tail
}
@ -82,7 +82,7 @@ void List<T>::print() const
template <typename T>
void List<T>::insert_front(Node<T> *p)
{
head->InsertAfter(p);
head->insert_after(p);
if (tail == head)
tail = p; // 注意可能修正tail
}
@ -90,7 +90,7 @@ void List<T>::insert_front(Node<T> *p)
template <typename T>
void List<T>::insert_rear(Node<T> *p)
{
tail->InsertAfter(p);
tail->insert_after(p);
tail = p;
}
@ -102,7 +102,7 @@ Node<T> *List<T>::delete_node(Node<T> *p)
tempP = tempP->link;
if (p == tail)
tail = tempP; // 修正tail
return tempP->RemoveAfter();
return tempP->remove_after();
}
#endif
Loading…
Cancel
Save