On Sunday, 26 July 2015 at 01:55:12 UTC, Enamex wrote:
On Saturday, 25 July 2015 at 09:14:04 UTC, Jonathan M Davis wrote:. . . auto foo(alias pred, R)(R r) if(testPred!pred && isInputRange!R && !isForwardRange!R) {}auto foo(alias pred, R)(R r) if(testPred!pred && isForwardRange!R) {} and be turning it into something like template foo(alias pred) if(testPred!pred) { auto foo(R)(R r) if(isInputRange!R && !isForwardRange!R) {} auto foo(R)(R r) if(isForwardRange!R) {} } . . . - Jonathan M DavisThe example(s) is confusing me. `foo!(first)(second);` isn't really an alternative to `foo(first, second);`_?_. Am I misreading something?
No. Yes. `first` is a compile time parameter and can be anything. In this case it defines a type (in examples T is used for generic type, and R for a range). but it can be anything, a type literal i.e. foo!(size_t a)(Bar b); , it can be another symbol ( a function, class or even another template (with is own set of args)! it can be varaidic as well i.e. foo!(T...)(some_args)
Second is the set of runtime parameters, which can be of types defined in the compile time args.
