www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16996] New: std.algorithm.remove with SwapStrategy.unstable

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

--
Dec 20 2016