mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-12 23:15:52 +08:00
fix: Corrected erase method in data_structures/linked_list.cpp (#1494)
This commit is contained in:
committed by
GitHub
parent
fd029aec78
commit
a5022c53f2
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user