[Issue 10777] New: std.algorithm.multiSort to return a std.range.SortedRange

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 8 07:33:35 PDT 2013


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

           Summary: std.algorithm.multiSort to return a
                    std.range.SortedRange
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-08-08 07:33:34 PDT ---
This is the signature of std.algorithm.multiSort:

void multiSort(Range)(Range r) if (validPredicates!(ElementType!Range, less));

I suggest to modify multiSort to make it return a SortedRange, just like
std.algorithm.sort(). This is handy to use multiSort in UFCS chains (sometimes
even using release).


Currently the implementation of SortedRange is:

struct SortedRange(Range, alias pred = "a < b")
if (isRandomAccessRange!Range && hasLength!Range)
{
    private alias binaryFun!pred predFun;
...


So perhaps SortedRange too should change a little to be usable for multiSort,
to support more than one sorting predicate.

-- 
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