www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5611] New: back() and front() with ref return + opSlice() in sort() constraint

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

           Summary: back() and front() with ref return + opSlice() in
                    sort() constraint
           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



With some experiments I have seen that the input of std.algorithm.sort() has
other requirements beside being just a random access range (dmd 2.052):
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=24795

My experiment shows that beside being a random access range, the input range
needs also:
- opSlice()
- back() and front() must return their results by ref.

So to reduce troubles for the users I suggest to add those three requirements
inside the template constraint of sort(), to produce a better error message and
detect problems more early.

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