Preffered way of writing variadic templated functions in 2.079

Nordlöw per.nordlow at gmail.com
Thu Mar 8 08:36:09 UTC 2018


Is using

https://dlang.org/changelog/2.079.0.html#default_after_variadic

for instance as

void show(Args...)(Args args,
                    string file = __FILE__,
                    uint line = __LINE__,
                    string fun = __FUNCTION__)
     if (Args.length >= 1)
{
     ...
}

preferred over previous usage

template show(Args...)
     if (Args.length >= 1)
{
     void show(string file = __FILE__,
               uint line = __LINE__,
               string fun = __FUNCTION__)
     {
         ...
     }
}

or are the two version equally good in terms of run-time, 
compile-time and (lack of) template symbol bloatedness?

See also

https://github.com/nordlow/phobos-next/blob/master/src/dbgio.d#L53


More information about the Digitalmars-d-learn mailing list