variadic mixin - the right tool for the job?

Robert M. Münch via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 19 05:56:12 PDT 2015


On 2015-03-18 15:27:03 +0000, Daniel Kozák via Digitalmars-d-learn said:

> You probably does not need mixins:
> 
> void log(string file = __FILE__, size_t line = __LINE__, T...)
> (T variadic_arg) {
>     some_fun(variadic_arg[0],  file, line, variadic_arg[1 .. $]);
> }

Hi, ha, forgot about default arguments. Great that this works and take 
the file & line number where the tempate function is used.

Thanks.

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list