Getting the source text of an expression

Dave P. dave287091 at gmail.com
Thu Dec 17 21:40:09 UTC 2020


On Thursday, 17 December 2020 at 21:24:40 UTC, FreeSlave wrote:
> On Thursday, 17 December 2020 at 19:45:38 UTC, Dave P. wrote:
>> [...]
>
> Something like that?
>
> import  std.stdio;
>
> void print_int(alias n)()
> {
>     writeln(n.stringof~"=", n);
> }
>
> void main()
> {
>     int x = 42;
>     print_int!(x);
>     print_int!(7);
> }

Very cool! Where can I read about what an alias as a template 
parameter does?


More information about the Digitalmars-d-learn mailing list