Passing a single tuple or multiple values
jmh530 via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jul 19 05:15:28 PDT 2016
On Tuesday, 19 July 2016 at 07:23:52 UTC, John wrote:
>
> auto bar(T...)(T x)
> {
> static if (T.length == 1 && isTuple!(T[0]))
> return foo(x.expand);
> else
> return foo(x);
> }
>
>>
>> void main()
>> {
>> auto x = tuple(1, 2);
>> auto y = bar(x);
>> auto z = bar(x.expand);
>> writeln(y);
>> writeln(z);
>> }
I was leaving out the T[0] in the isTuple!
More information about the Digitalmars-d-learn
mailing list