isRangeOf ?
bearophile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Nov 4 04:07:19 PST 2014
Jonathan M Davis:
> That loses the ability to test which type of range you're
> talking about.
Yes, one can think about templates like "isForwardRangeOf", etc.
But for such specialized cases I think using
isForwardRange+is(ElementType) is acceptable and avoids adding
too many templates to Phobos. isRangeOf is for the common case
where any range is OK (a forward range), and you need a range of
items of type T (opApply still gives an iterable but
unfortunately it's not compatible with most Phobos. That's why I
have not suggested a function named "isIterableOf" meant to
accept opApply too).
I have opened an ER:
https://issues.dlang.org/show_bug.cgi?id=13682
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list