Aliasing current function template instance
Jean-Louis Leroy
jl at leroy.nyc
Fri May 1 21:14:09 UTC 2020
On Friday, 1 May 2020 at 21:05:17 UTC, Adam D. Ruppe wrote:
> On Friday, 1 May 2020 at 20:28:58 UTC, Jean-Louis Leroy wrote:
>> Something I have overlooked? Any ideas?
>
> There's an old rule, that I can't find in the spec anymore but
> I'm still pretty sure it is there, where taking the address of
> a template inside a template yields the current instantiation.
>
> Then you can fetch the type of that and do some reflection off.
> So try this in your test rig:
>
> pragma(msg, Parameters!(typeof(&foo)));
>
> This rule was in there to ease callbacks and recursive
> functions iirc but it can also work with you thanks to typeof
> turning the runtime address back into a compile time alias.
It looks like it does the trick. Thanks! Trying to add support
for method templates to openmethods.
More information about the Digitalmars-d-learn
mailing list