[Issue 5224] std.algorithm.remove!(SwapStrategy.unstable) doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 22 03:05:02 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=5224


SomeDude <lovelydear at mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear at mailmetrash.com
           Platform|x86                         |All
         OS/Version|Windows                     |All


--- Comment #3 from SomeDude <lovelydear at mailmetrash.com> 2012-04-22 03:05:59 PDT ---
Although the unit tests pass, they seem insufficient.
This example actually comes from a comment in algorithm.d and yet it fails on
2.059:

int[] a = [ 0, 1, 2, 3 ];
assert(remove!(SwapStrategy.unstable)(a, 1) == [ 0, 3, 2 ]);

(returns [3, 1, 2])
Idem for SwapStrategy.semistable

Also, in one comment of algorithm.d, there is a typo. According to the
explanation under the example, line 5914 of algorithm.d should be:
int[] a = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
assert(remove(a, 1, tuple(3, 5), 9) == [ 0, 2, 5, 6, 7, 8, 10 ]);
                                               ^-- forgotten

"The tuple passes in a range closed to the left and open to
the right"

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list