Unpack Variadic Args?
Jeff
jeff.monkey.wrench.thirtytwo at gmail.com
Thu Feb 13 07:06:49 UTC 2020
Hello,
Was wondering if there was a simple, efficient way to unpack a
variadic template argument. It needs to be efficient at runtime,
and hopefully not use too much excessive CTFE.
C++ has the "..." operator, is there something equivalent in D?
template<class ...Args>
void g(Args... args) {
f(foo(args)...); // f(foo(args[0]), foo(args[1])); // etc
}
What would be a good way to write that in D, with it being as
efficient (no copies or building structs etc) and not use too
much CTFE. Needing to use `.map` or similar at CTFE would be an
example of too much CTFE.
void g(Args...)(auto ref Args args) {
// ?
}
More information about the Digitalmars-d-learn
mailing list