forward variadic arguments

Deewiant deewiant.doesnotlike.spam at gmail.com
Thu Jun 15 08:57:58 PDT 2006


Frank Benoit wrote:
>  void execSql( char[] aSql, ... ){
>   char[] sql = std.string.format( aSql, _arguments, _argptr );
>   database.exec( sql );
>  }
> 
> The forwarding of all arguments to format() seams not to work.
> how can I do this?
> 

You'll need to do it "manually" by calling the std.format.doFormat function.

void execSql(char[] aSql, ...) {
	char[] sql;
	void putc(dchar c) {
		sql ~= c;
	}

	std.format.doFormat(&putc, _arguments, _argptr);

	database.exec(sql);
}



More information about the Digitalmars-d-learn mailing list