On Friday, 2 February 2024 at 19:22:22 UTC, Steven Schveighoffer wrote:
```d
void foo(Variant x, Variant y) { ... }

import std.meta : allSatisfy;

enum isVariant(T) = is(T == Variant);

// this is going to suck at CTFE but...
string argsAsVariants(size_t count)
{
   import std.format;
   import std.range;
   import std.alglorithm;
   import std.array;
return iota(count).map!(i => format("Variant(args[%s])", i).join(",");
}

// shim
auto foo(Args...)(Args args) if (!allSatisfy!(isVariant, Args))
{
    mixin("return foo(", argsAsVariants(args.length), ");");
}
```

Thanks for this idea. I'll work on it.

-Steve


Reply via email to