How to delegate varargs

Sean Kelly sean at f4.ca
Tue Nov 20 12:51:33 PST 2007


Tomas Lindquist Olsen wrote:
> Frank Benoit wrote:
>> How can I delegate the variadic argument list to another variadic
>> argument function?
>>
>> e.g.
>> void myWritef( char[] frm, ... ){
>>   writefln( frm, ??? );
>> }
>>
>> And how can I add or remove arguments to these varargs?
> 
> You have to write a "wrapper" function that explicitly takes the hidden 
> arguments. In the case of writefln, phobos provides OutputStream.writefx.

Yup, and this stinks.  I don't suppose some language feature could be 
provided for working around this?


Sean



More information about the Digitalmars-d mailing list