On Thursday, 1 March 2018 at 16:46:30 UTC, Yuxuan Shui wrote:
On Wednesday, 28 February 2018 at 15:49:25 UTC, aliak wrote:
On Wednesday, 28 February 2018 at 15:09:56 UTC, Yuxuan Shui
wrote:
For a template instantiation expression like A!(B, C!(D, E)),
I want to get a string "A!(B, C!(D, E))", better if A, B, C,
D, E is replaced by fully qualified name.
Is this possible?
A!(B, C!(D, E)).stringof I guess. Will print the former.
There's a Learn forum as well btw :)
Cheers
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
Even worse, if the template instantiation yields another
template, e.g:
template A(T) { template A(T) {} }
A!int.stringof returns "A(T)", which is not useful at all.