www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13682] New: std.range.isRangeOf?

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

          Issue ID: 13682
           Summary: std.range.isRangeOf?
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

Sometimes I have a function that just needs an iterable (sometimes and
opApply-based iterable is OK too, but this is enhahcement request is just for
ranges):


void foo(Range)(Range data)
if (isForwardRange!Range && is(Unqual!(ForeachType!Range) == 
int)) {}


So perhaos it's a good idea to add a simple "isRangeOf" template to Phobos:

void foo(Range)(Range data)
if (isRangeOf!(Range, int)) {}

--
Nov 04 2014