Reputation: 1118
I have a function void foo(...)
and a function void bar(...)
and I want to call bar from foo, in a way that bar
receives the same variable argument list than foo
.
Is that possible in D?
Thanks!
Upvotes: 5
Views: 380
Reputation: 48196
if you use templates yes
void foo(A...)(A a){
bar(a);
}
void bar(B...)(B b){
//...
}
the a
gets expanded that compile time to what arguments it was called with
you can also slice[] off some arguments, or you add an argument to the list
Upvotes: 7