How to stringify a template instantiation expression?

aliak something at something.com
Thu Mar 1 22:41:52 UTC 2018


On Thursday, 1 March 2018 at 16:46:30 UTC, Yuxuan Shui wrote:
> Did you actually try that? With dmd 2.079-rc1, this:
>
> template A(T...) {}
> struct B {}
> struct D {}
> struct E {}
> template C(T...) {}
> pragma(msg, (A!(B, C!(D, E))).stringof);
>
> Prints:
>
> A!(B, __T1CTS2ax1DTSQh1EZ)
>
> When compiled

Yep, though not all possible combinations of course:

struct X(T...) {}

void main() {
     writeln(X!(int, X!(X!(int), float), char).stringof);
}

Seems like if you throw in template templates then things get a 
little more ... complicated.


More information about the Digitalmars-d mailing list