[Issue 16996] New: std.algorithm.remove with SwapStrategy.unstable removes more entries

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Dec 20 13:47:57 PST 2016


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

          Issue ID: 16996
           Summary: std.algorithm.remove with SwapStrategy.unstable
                    removes more entries
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: greeenify at gmail.com

I assume the following is a bug:

auto a = [ 0, 1, 2, 3, 4, 5 ];
assert(remove!(SwapStrategy.stable)(a, tuple(1, 4)) == [0, 4, 5]);
a = [ 0, 1, 2, 3, 4, 5 ];
assert(remove!(SwapStrategy.unstable)(a, tuple(1, 4)) == [0]);

or at least this behavior should be properly documented.

--


More information about the Digitalmars-d-bugs mailing list