isRangeOf ?

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 4 01:40:58 PST 2014


Sometimes I have a function that needs an iterable:

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


So is it a good idea to add a "isRangeOf" template to Phobos?

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

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list