Summary: stable sort assertion failure for repeated key
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos

--- Comment #0 from Andrew Talbot <> 2009-12-21 
13:40:32 PST ---
Performing a stable sort on a repeated pair of keys that are already in sorted
order causes the following error message.

core.exception.asserter...@std.algorithm(3736): Assertion failure

However, doing so with repeated reverse-sorted keys works fine.

In other words, a stable sort of the array
[ "B", "A", "B", A" ] will succeed, but one of ["A", "B", "A", "B" ] will fail.

Illustrative code:

import std.algorithm;
import std.stdio;

void main()
    auto ar1 = [ "B", "A", "B", "A" ];
    sort!("a <  b", SwapStrategy.stable)(ar1); // ok

    auto ar2 = [ "A", "B", "A", "B" ];
    sort!("a <  b", SwapStrategy.stable)(ar2); // fails

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to