On Wednesday 07 October 2015 02:22, Steven Schveighoffer wrote:
> On 10/6/15 4:27 PM, anonymous wrote:
[...]
>> void foo(T...)(string str=null, T args = T.init) {
[...]
> I find it quite fascinating that in anonymous' solution, the T.init
> doesn't ever actually get used!
It's not used with
On Tuesday 06 October 2015 22:01, Nick Sabalausky wrote:
> Ok, D-style varargs can accept a parameter length of zero:
>
> ---
> void foo(T...)(T args) {
> //...
> }
> foo();
> foo(t1, t2);
> ---
Terminology fun:
The spec uses the term "D-style variadic function"
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???+/)
On 10/6/15 4:27 PM, anonymous wrote:
You can put an expression tuple ("expression AliasSeq"??) there. T.init is
one that always fits T's types. But you could generate one with different
values, too.
void foo(T...)(string str=null, T args = T.init) {
//...
}
void main()
{