is operator and SortedRange
RazvanN via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Nov 11 03:49:25 PST 2016
I am a bit confused about how the is operator works. I have a
function which receives an InputRange and a predicate. Now I need
to be able to test if the InputRange is actually a SortedRange. I
don't care about how the datatypes behind the SortedRange or the
predicate, I just need to see if the object is a SortedRange. I
have tried the following test:
static if(is(typeof(haystack) == SortedRange!(T, _pred), T,
_pred))
where haystack is the InputRange, but the test fails. Is there a
way to test if the InputRange is a SortedRange without having to
explicitly pass the primitive tupe on top of which the
SortedRange is built?
More information about the Digitalmars-d-learn
mailing list