how does isInputRange(T) actually work?

kevin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 21 12:06:38 PDT 2015


enum bool isInputRange = is(typeof(
     (inout int = 0)
     {
         R r = R.init;     // can define a range object
         if (r.empty) {}   // can test for empty
         r.popFront();     // can invoke popFront()
         auto h = r.front; // can get the front of the range
     }));


... is the current implementation in Phobos. But I can't seem to 
understand this syntax. What is (inout int = 0)? Why can a block 
follow it?

My guess is that this is declaring some sort of function and 
testing if it is syntactically valid, but this is still strange 
to me.


More information about the Digitalmars-d-learn mailing list