www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13128] New: std.container.array.Array.stableLinearRemove is


          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 puremagic.com
          Reporter: jakobovrum 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

Jul 13 2014