On Wednesday, 13 March 2019 at 17:38:02 UTC, Victor Porton wrote:
Why this template code does not compile?
///
module runnable;
import std.meta;
import std.typecons;
template FieldInfo(argT, string argName) {
template FieldInfo(Nullable!argT argDefault =
Nullable!argT()) {
}
}
alias processFields(T, string name) =
AliasSeq!(FieldInfo!(T, name)());
The inner `FieldInfo` template isn't a function, but by adding a
second set of parentheses after `(T, name)`, you're attempting to
call it as one.
If you want to instantiate the inner template with its default
argument, you can use `std.meta.Instantiate`:
alias processFields(T, string name) =
AliasSeq!(Instantiate!(FieldInfo!(T, name)));