On Tuesday, 15 May 2018 at 13:16:21 UTC, Steven Schveighoffer wrote:
[snip]

Hm... neat idea. Somehow, opDispatch can probably be used to make this work even more generically (untested):

struct WithAlloc(alias alloc)
{
auto opDispatch(string s, Args...)(auto ref Args args) if (__traits(compiles, mixin(s ~ "(args, alloc)")))
   {
      mixin("return " ~ s ~ "(args, alloc);");
   }
}

-Steve

Example:
https://run.dlang.io/is/RV2xIH

Reply via email to