On Saturday, 20 July 2019 at 04:18:15 UTC, Adam D. Ruppe wrote:
show me what you're doing now and I'll see which case it is. Most the time I see these, the code is significantly simplified and bugs fixed by removing the usages of these strings..

I want to do this in betterC:

template asPure(string P, alias Fn) if (isFunctionPointer!(typeof(&Fn))) {
        enum N = __traits(identifier, Fn);
enum string asPure = "private alias " ~ N ~ "_P = " ~ typeof(&Fn).stringof ~ " pure;\n" ~ "__gshared immutable " ~ N ~ "_P " ~ P ~"= cast(" ~ N ~ "_P) &" ~ N ~ " ;" ;
}

Reply via email to