Ok, D-style varargs can accept a parameter length of zero:

---------------
void foo(T...)(T args) {
    //...
}
foo();
foo(t1, t2);
---------------

Is there any way to stick a param with a default value before that?

---------------
void foo(T...)(string str=null, T args=/+what goes here???+/) {
    //...
}
foo();
foo(str);
foo(str, t1, t2);
---------------

Obviously this can be worked around easily enough by splitting it into two overloads ("foo(string str=null)" and "foo(string str, T args)"), but is there a way to do it in one?

Reply via email to