Voting: std.logger

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 10 09:34:35 PDT 2014


On 9/10/14, 1:47 AM, Robert burner Schadek wrote:
> On Wednesday, 10 September 2014 at 07:41:49 UTC, Andrei Alexandrescu wrote:
>> There may be a miscommunication here. In short:
>>
>> void fun(int x, string f = __FILE__)(double y);
>>
>> can be replaced with:
>>
>> void fun(int x)(double y, string f = __FILE__);
>>
>> Both work and the second produces fewer instantiations.
>>
>>
>> Andrei
>
> But
>
> void fun(int l = __LINE__, A...)(A...); cannot be replaced by
> void fun(A...)(A..., int l = __LINE__);
>
> anyway thanks for reading and for trying to help

One possibility is to have the first function be a one-liner that 
forwards to another. That way there will be less code bloating.

void fun(uint l = __LINE__, A...)(A... as) {
   funImpl(l, as);
}

private void funImpl(A...)(uint line, A...) {
   ... bulk of the code goes here ...
}


Andrei



More information about the Digitalmars-d mailing list