Exactly Replicating a Function's Signature?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Wed Jan 19 07:37:37 PST 2011
Never mind my stupid build script didn't recompile and it ran an old
version. Fixed:
import std.stdio;
import std.traits;
auto test(alias F)(ParameterTypeTuple!(F) args)
{
ReturnType!(F) otherFunc(ParameterTypeTuple!(F) args)
{
typeof(return) result;
result = args[0] + args[1] * 2.5;
return result;
}
return otherFunc(args);
}
double foo(int x, int y)
{
double result;
return x + y * 2.5;
}
void main()
{
writeln(test!(foo)(4, 5));
}
More information about the Digitalmars-d-learn
mailing list