Skip to content

Commit

Permalink
Fixed foreach issue caused by a missing decrement
Browse files Browse the repository at this point in the history
  • Loading branch information
ZILtoid1991 committed May 15, 2021
1 parent 79629f0 commit fa15bed
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/collections/linkedlist.d
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public struct LinkedList(E, bool allowDuplicates = true, alias equal = "a == b")
E result = (*crnt).elem;
*crnt = (*crnt).next;
nOfElements--;
end--;
return result;
}
crnt = &(*crnt).next;
Expand Down Expand Up @@ -441,6 +442,9 @@ unittest {
lnl ~= [8, 6, 4, 2, 9];
assert(lnl.arrayOf == [11, 5, 8, 8, 6, 4, 2, 9], lnl.toString);
assert(lnl[2..6].arrayOf == [8, 8, 6, 4], lnl[2..6].toString);
foreach (e; lnl) {

}
}

unittest {
Expand Down Expand Up @@ -470,6 +474,9 @@ unittest {
sa.removeByElem(-1);
assert(sa.length == 3);
assert(!sa.has(-1));
foreach (e ; sa) {

}
}

unittest { //test set operators
Expand Down

0 comments on commit fa15bed

Please sign in to comment.