Re: Aliasing current function template instance

2020-05-01 Thread Jean-Louis Leroy via Digitalmars-d-learn
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 t

Re: Aliasing current function template instance

2020-05-01 Thread Adam D. Ruppe via Digitalmars-d-learn
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.

Re: Aliasing current function template instance

2020-05-01 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 1 May 2020 at 20:28:58 UTC, Jean-Louis Leroy wrote: Is it possible, inside a function template, to create an alias to the instantiated function? IOW the equivalent of __FUNCTION__, but yielding an alias? The closest I came is: import std.string; import std.traits; void foo(T

Re: Aliasing current function template instance

2020-05-01 Thread Jean-Louis Leroy via Digitalmars-d-learn
On Friday, 1 May 2020 at 20:43:05 UTC, Steven Schveighoffer wrote: On 5/1/20 4:28 PM, Jean-Louis Leroy wrote: Something I have overlooked? Any ideas? This trick works. No idea who came up with it: alias thisFunction = __traits(parent, {}); -Steve I think I get the idea. Alas it doesn't w

Re: Aliasing current function template instance

2020-05-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/1/20 4:28 PM, Jean-Louis Leroy wrote: Something I have overlooked? Any ideas? This trick works. No idea who came up with it: alias thisFunction = __traits(parent, {}); -Steve

Aliasing current function template instance

2020-05-01 Thread Jean-Louis Leroy via Digitalmars-d-learn
Is it possible, inside a function template, to create an alias to the instantiated function? IOW the equivalent of __FUNCTION__, but yielding an alias? The closest I came is: import std.string; import std.traits; void foo(T)(lazy T) { mixin( "alias thisFunction = ", __