www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17032] New: Sortedness of a range should be propagated

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

          Issue ID: 17032
           Summary: Sortedness of a range should be propagated
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: greeenify gmail.com

Since https://github.com/dlang/phobos/pull/4907, find has a specialization for
SortedRange, however if another range function was applied before (e.g. `take`)
the check won't work.

It's probably possible to check the type and see if there's a SortedRange
occuring. If so a simple solution would be to iterate towards it and check
whether the struct on the way have a `propagatesSortedness` property.

However this of course won't work for something like `retro`.

--
Dec 25 2016