On Saturday, 23 October 2021 at 18:36:27 UTC, Tim wrote:
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.

So before I had OUTPUT_REPRO_CASE defined like this:

enum OUTPUT_REPRO_CASE(alias func) = "build the actual code stuff with"~fullyQualifiedName!func~" and so on";

And I tried to use your suggestion like this:

enum OUTPUT_REPRO_CASE(alias func = __traits(parent, {})) = "build the actual code stuff with"~fullyQualifiedName!func~" and so on";

Which doesn't work. In that case func seems to become the parent namespace. If I substitute fullyQualifiedName!func with fullyQualifiedName!(__traits(parent, {}))) I get a circular dependecy error.

How do I have to use this exactly?



Reply via email to