www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18280] New: std.algorithm.comparison.cmp for non-strings

https://issues.dlang.org/show_bug.cgi?id=18280

          Issue ID: 18280
           Summary: std.algorithm.comparison.cmp for non-strings should
                    call opCmp only once per item pair
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: n8sh.secondary hotmail.com

Right now when comparing non-string ranges std.algorithm.comparison.cmp calls
the comparison predicate twice for every pair of elements to determine their
order. When the elements have overloaded `opCmp` and the predicate is "a < b"
we only need to call `opCmp` once for each pair.

--
Jan 22 2018