www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18797] New: Use of "isInputRange" in various functions is


          Issue ID: 18797
           Summary: Use of "isInputRange" in various functions is
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: eyal weka.io

std.algorithm.sorting.topNCopy, for example, uses isInputRange!SRange when it
merely iterates its elements. To iterate the elements, an opApply range is
fine, but is unnecessarily forbidden.

Various other phobos functions use isInputRange when they only need the ability
to iterate.

Need a "isForeachRange" template perhaps, to replace "isInputRange" when only
foreach is needed? Or perhaps an assertion on the "ForeachType!T" should be
used instead here?

Apr 25 2018