Variadic Templates or functions with Lazy Evalutaion
convert
convert at somewhere.com
Tue Aug 14 14:51:06 PDT 2007
I am trying to write a log function that can take a variable number of arguments and does lazy evaluation on each of them.
-------------
void log(A...) (int level ,lazy A args)
{
if(level > 1) Stdout(args).newline();
}
log(2, "Hello");
-----------
Produces:
test2.d(22): template instance test2.log!(char[6u]) error instantiating
test2.d(22): Error: functions cannot return static array char[6u]
And
void log(int level ,lazy ...)
produces:
test2.d(15): basic type expected, not ...
Should any of these work?
More information about the Digitalmars-d-learn
mailing list