fix: Corrected erase method in data_structures/linked_list.cpp (#1494)

This commit is contained in:
Bolaji Boluwatife
2021-05-09 20:24:05 -07:00
committed by GitHub
parent fd029aec78
commit a5022c53f2

View File

@@ -167,6 +167,9 @@ void list::erase(int old_elem) {
t->succ() = t->succ()->succ();
to_be_removed.reset();
if (t->succ() == nullptr) {
last = t;
}
if (first == last){
last = nullptr;
}
}