Thread overview
[Issue 3946] New: schwartzSort - SwapStrategy always unstable
Mar 13, 2010
Ilya Yaroshenko
March 13, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3946

           Summary: schwartzSort - SwapStrategy always unstable
           Product: D
           Version: 2.041
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: 9il@rambler.ru


--- Comment #0 from Ilya Yaroshenko <9il@rambler.ru> 2010-03-13 00:41:34 PST ---
In the last line sort calling without "ss" (SwapStrategy) - it is looks like
always unstable:

module std.algorithm;

void schwartzSort(alias transform, alias less = "a < b",
        SwapStrategy ss = SwapStrategy.unstable, Range)(Range r)
    if (isRandomAccessRange!(Range) && hasLength!(Range))
{
    alias typeof(transform(r.front)) XformType;
    auto xform = new XformType[r.length];
    foreach (i, e; r)
    {
        xform[i] = transform(e);
    }
    auto z = zip(xform, r);
    alias typeof(z.front()) ProxyType;
    bool myLess(ProxyType a, ProxyType b)
    {
        return binaryFun!(less)(a.at!(0), b.at!(0));
    }
    sort!(myLess)(z);                               /// <-------------
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 13, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3946


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com


--- Comment #1 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-03-13 07:00:46 PST ---
Thanks!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 13, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3946


Lars T. Kyllingstad <bugzilla@kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@kyllingen.net
         AssignedTo|nobody@puremagic.com        |bugzilla@kyllingen.net


--- Comment #2 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2010-08-13 03:56:53 PDT ---
http://www.dsource.org/projects/phobos/changeset/1845

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 27, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3946


Lars T. Kyllingstad <bugzilla@kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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