xxxxxxxxxx
import std;
struct Metacall
{
template opDispatch(string name)
{
static T opDispatch(T = void, Args...)(Args args)
{
writeln("Called function ", name, " with args ", args, " with return type ", T.stringof);
static if (!is(T == void)) return T.init;
}
}
}
void main()
{
Metacall.hello(1, 2);
Metacall.hello(3, 4);
Metacall.hello!int(5, "ok");
}