April 12, 2014 DList bug or programmer error? | ||||
|---|---|---|---|---|
| ||||
This block of code fails the second assert, why? Using stableRemove{Front,Back} does not fix it.
----
import std.range;
import std.container;
unittest {
auto dl2 = DList!int([2,7]);
dl2.removeFront();
//dl2.stableRemoveFront();
assert(dl2[].walkLength == 1);
dl2.removeBack();
//dl2.stableRemoveBack();
assert(dl2.empty, "not empty?!");
}
void main(){
}
----
rdmd -unittest file.d
| ||||
April 12, 2014 Re: DList bug or programmer error? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Daniel K | On Saturday, 12 April 2014 at 19:34:11 UTC, Daniel K wrote:
> This block of code fails the second assert, why?
Because DList is buggy. It should pass.
I have an open pull that fixes this, FYI.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply