www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10777] New: std.algorithm.multiSort to return a std.range.SortedRange

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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc



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: -------
Aug 08 2013