[Issue 18797] New: Use of "isInputRange" in various functions is overly-restrictive
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Apr 25 12:11:27 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18797
Issue ID: 18797
Summary: Use of "isInputRange" in various functions is
overly-restrictive
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: eyal at 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?
--
More information about the Digitalmars-d-bugs
mailing list