Passing variadic arguments in one function to another function in D

d, variadic-functions

Solution

This will do it for you:

import std.stdio;
void customWrite(Args...)(string format, Args args)
{
    writefln(format, args);
}

Problem

I have a variadic D-style function `foo(format, ...)`, which is a wrapper around `writefln`. I'd like to do something like this: ``` foo(format, <...>) { //... writefln(format, ...); } ``` Essentially, passing on the ellipsis parameter(s) to writefln. I understand that this isn't easy/possible in C/C++, but is there a way to accomplish this in D?

Original source