Georg Wrede wrote:
Andrei Alexandrescu wrote:

void foo_templated(T...)(T args)
{
   Variant[args.length] dynatyped;
   foreach (i, arg; args) dynatyped[i] = arg;
   return foo(dynatyped);
}
void foo(Variant[] dynatyped...)
{
   ...
}

Hmm. An idiom. My sweet tooth just got thirsty for syntactic sugar!

When opImplicitCastFrom will be implemented, foo's definition will be enough. You'll write foo(1, 2.3, "a") and the compiler will rewrite it to foo(Variant(1), Variant(2.3), Variant("a")).

Andrei

Reply via email to