Default argument for template tuple function parameter

Timon Gehr timon.gehr at gmx.ch
Tue Sep 6 04:37:55 PDT 2011


On 09/06/2011 01:01 PM, Vladimir Panteleev wrote:
> AddressInfo[] getAddressInfo(T...)(string node, string service = null, T
> options)

TypeTuple!() emptyTuple;

AddressInfo[] getAddressInfo(T...)(string node, string service = null, T 
options=emptyTuple) {}

Error: cannot implicitly convert expression (tuple()) of type () to ()

And this smells like a compiler bug.

Workaround:

AddressInfo[] getAddressInfo()(string node){return 
getAddressInfo(node,cast(string)null);}
AddressInfo[] getAddressInfo(T...)(string node, string service, T options);


More information about the Digitalmars-d-learn mailing list