Skip to content

Commit

Permalink
Fixed bug related to removal from linked sets
Browse files Browse the repository at this point in the history
  • Loading branch information
ZILtoid1991 committed May 15, 2021
1 parent 53ded62 commit 79629f0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/collections/linkedlist.d
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ public struct LinkedList(E, bool allowDuplicates = true, alias equal = "a == b")
if (binaryFun!equal((*crnt).elem, value)) {
E result = (*crnt).elem;
*crnt = (*crnt).next;
nOfElements--;
return result;
}
crnt = &(*crnt).next;
Expand Down Expand Up @@ -466,6 +467,9 @@ unittest {
assert(sc.has(10), sc.toString());
assert(sd.has(-1), sd.toString());
assert(!se.has(-1), se.toString());
sa.removeByElem(-1);
assert(sa.length == 3);
assert(!sa.has(-1));
}

unittest { //test set operators
Expand Down

0 comments on commit 79629f0

Please sign in to comment.