xxxxxxxxxx
struct SList {
this(T)(int n, T alloc) {}
}
struct DList {
this(T)(int n, T alloc) {}
}
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);");
}
}
struct DumbAlloc { }
void main() {
auto alloc = new DumbAlloc;
auto withAlloc = WithAlloc!(alloc)();
auto slist = withAlloc.SList(0);
auto dlist = withAlloc.DList(0);
}