Get function argument name?
JN
666total at wp.pl
Sun Mar 4 21:48:53 UTC 2018
On Sunday, 4 March 2018 at 21:12:44 UTC, arturg wrote:
>
> you can pass it by alias:
>
> import std.stdio;
>
> void main(string[] args)
> {
> int x;
> printName!(x);
> }
>
> void printName(alias var)()
> {
> writeln(__traits(identifier, var), " ", var);
> }
Well, it works. But I am confused now, why. Isn't alias only for
types (like a typedef)? Why can we use it for variable here?
More information about the Digitalmars-d-learn
mailing list