std.traits.ParameterIdentifierTuple bug or not?
Uranuz
neuranuz at gmail.com
Thu Nov 7 10:19:56 PST 2013
In my programme I need to get names of function parameters when I
pass some function reference to template function that does some
manipulations with it. I have updated my copy of dmd to 2.064,
because there was a bug in previous versions.
http://d.puremagic.com/issues/show_bug.cgi?id=9967
But I still can't implement the stuff that I wanted. I don't know
is it bug or not, so I asking for help. I'm trying to do
something like this:
//-------------------
module parameter_identifier_test;
import std.stdio, std.string, std.conv, std.traits, std.typecons;
void someFunc(int[] aaa, string[string] bbb, double ccc)
{
writeln("Some function executed!!!");
}
void test(FunctionT)(FunctionT func)
{
alias ParameterIdentifierTuple!(FunctionT) ParamNames;
pragma(msg, ParamNames); //Gives compilation output: tuple("",
"", "")
writeln(ParamNames); //Gives empty string
}
void main()
{
test(&someFunc);
}
//------------------------
Live demo is available at: http://dpaste.dzfl.pl/32300c82
Is there some other way to get names of parameters in situation
like this?
More information about the Digitalmars-d
mailing list