On 04/21/2015 12:06 PM, kevin wrote:
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.
I try to explain that syntax here:
http://ddili.org/ders/d.en/templates_more.html#ix_templates_more.named%20template%20constraint
Ali