std.traits.ParameterIdentifierTuple bug or not?

Dicebot public at dicebot.lv
Thu Nov 7 10:29:33 PST 2013


On Thursday, 7 November 2013 at 18:19:57 UTC, Uranuz wrote:
> 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?

You need to use template alias parameter: 
http://dpaste.dzfl.pl/92de7a5a
Function types are decouples from their declarations and this 
can't provide metainformation such as parameter names or attached 
UDA's


More information about the Digitalmars-d mailing list