Is there an alternative to "__FUNCTION__" that gives the actual function symbol and not the name as a string?

Tim tim.dlang at t-online.de
Sat Oct 23 18:36:27 UTC 2021


On Saturday, 23 October 2021 at 18:23:47 UTC, Simon wrote:
> So what I am looking for then is the equivalent to __FUNCTION__ 
> that evaluates to the actual symbol of the function instead of 
> its name, so it can be used as a parameter to 
> ParameterIdentifierTuple.

You could use the following:

alias F = __traits(parent, {});

The lambda {} is a symbol inside the function. F will be its 
parent, which is the function itself.


More information about the Digitalmars-d-learn mailing list