On Thursday, 7 March 2019 at 20:34:48 UTC, Johannes Loher wrote:
auto profile_scope(string name)
{
import std.format : format;
return q{import std.stdio : writeln; writeln("%1$s");
scope(exit)
writeln("%1$s");}.format(name);
}
void main()
{
mixin(profile_scope("func1"));
}
Is there a way to achieve this while compiling with -betterC? I
use a custom string struct right now, and your version needs
TypeInfo, concatening using ~ needs the garbage collector. I have
the feeling D is really not agreeing with the way I want to do
things. If this is not possible, I will just roll with the Adam's
struct solution.