Re: variadic mixin - the right tool for the job?

2015-03-19 Thread Robert M. Münch via Digitalmars-d-learn
On 2015-03-18 15:27:03 +, 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

variadic mixin - the right tool for the job?

2015-03-18 Thread Robert M. Münch via Digitalmars-d-learn
Hi, can something like this (I borrowed the C pre-processor idea) be done with variadic mixins? #define log(variadic-arg) sys-log(%s:%s + variadic-arg[0], __FILE__, __LINE__, variadic-arg[1..$]); I read that mixins can only be used for declarations, and this here is a function call. So

Re: variadic mixin - the right tool for the job?

2015-03-18 Thread Daniel Kozák via Digitalmars-d-learn
On Wed, 18 Mar 2015 15:35:03 +0100 Robert M. Münch via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Hi, can something like this (I borrowed the C pre-processor idea) be done with variadic mixins? #define log(variadic-arg) sys-log(%s:%s + variadic-arg[0], __FILE__,