Hello, For the given example below,
E1: template Chain(R...) if (allSatisfy!(isInputRange, R)) { static if (R.length > 1) alias ChainImpl!(R) Chain; else alias R[0] Chain; } Q1: What's *if* statement doing right after the template definite?I can guess what the purpose is but I can not find the answer from the spec. E2: template isInputRange(R) { enum bool isInputRange = is(typeof( { R r; // can define a range object if (r.empty) {} // can test for empty r.popFront; // can invoke next auto h = r.front; // can get the front of the range }())); } Q2:What's the logic inside the enum...{} blocks? Q3:The *typeof* expression here. is it an anonymous function/delegate which return a bool value?If not,how come there is a () pairs appeared right after the enum{}blocks?If yes,shouldn't the () pairs appear before the last *)* ? It would be grateful if anybody can help. Regards, Sam