[Issue 13128] New: std.container.array.Array.stableLinearRemove is erroneously an alias to std.algorithm.remove (and linearRemove is not stable)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jul 13 21:40:38 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13128

          Issue ID: 13128
           Summary: std.container.array.Array.stableLinearRemove is
                    erroneously an alias to std.algorithm.remove (and
                    linearRemove is not stable)
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: jakobovrum at gmail.com

Array provides linear removal, but the `stableLinearRemove` alias for the
non-boolean specialization points to std.algorithm.remove, not its own
`linearRemove` member as it should.

However, it turns out that while Array tries to make removal stable, a bug
prevents it from actually being stable at the moment:

---
import std.container : Array;
import std.stdio : writeln;

void main()
{
    auto arr = Array!int(1, 2);
    auto r = arr[];
    arr.linearRemove(arr[0 .. 1]);
    writeln(r); // Range violation
}
---

--


More information about the Digitalmars-d-bugs mailing list