xxxxxxxxxx
import std.meta;
void main()
{
pragma(msg, __traits(getMember, A, "Foo1").stringof); // Foo1(int N) if (N & 1)
pragma(msg, __traits(getAttributes, __traits(getMember, A, "Foo1"))); // tuple("int", "odd")
alias f1a = Instantiate!(__traits(getMember, A, "Foo1"), 1); // This is expected
pragma(msg, f1a); // A
alias f1b = Instantiate!(__traits(getMember, A, "Foo1"), "+"); // Why would I know that I can even instantiate?? Also, can I haz UDA plz?
pragma(msg, f1b); // B
}
class A {
"int", "odd") (
template Foo1(int N) if (N & 1) {
enum Foo1 = "A";
}
"string", "+") (
template Foo1(string op) if (op == "+") {
enum Foo1 = "B";
}
}