Is there a "nice" way to access the names of template parameters outside?

Paul Backus snarwin at gmail.com
Tue Jul 27 10:49:46 UTC 2021


On Tuesday, 27 July 2021 at 10:15:51 UTC, Lukas  Borin wrote:
> On Tuesday, 27 July 2021 at 09:31:07 UTC, Paul Backus wrote:
>> On Tuesday, 27 July 2021 at 08:15:12 UTC, Lukas  Borin wrote:
>>> Consider the following template
>>>
>>> ```D
>>> auto foo(T, int W, int H)(T p1, T p2) { }
>>> ```
>>>
>>> Is there a "nice" way from the outside the get the names of 
>>> the template values?
>>
>> As far as I'm aware there is no way to introspect on template 
>> parameters at all.
>
> Let's say i instantiate the template does that change anything? 
> Can I get the "placeholder" names in any way then?

I don't think instantiating it changes anything. The underlying 
issue is that `is(symbol == __parameters)` doesn't work on 
templates.


More information about the Digitalmars-d-learn mailing list