Re: Template parameter defaults

2011-05-31 Thread Steven Schveighoffer
On Mon, 30 May 2011 09:42:53 -0400, Johann MacDonagh johann.macdonagh@spam..gmail.com wrote: I'm wondering if there's a cleaner way to do this: class Test(T = uint) { this(string s) { } } void main(string[] argv) { auto a = new Test!()(test); } I'd *like* to be able

Re: Template parameter defaults

2011-05-31 Thread Jonathan M Davis
On 2011-05-31 10:49, Steven Schveighoffer wrote: On Mon, 30 May 2011 09:42:53 -0400, Johann MacDonagh johann.macdonagh@spam..gmail.com wrote: I'm wondering if there's a cleaner way to do this: class Test(T = uint) { this(string s) { } } void main(string[] argv)

Re: Template parameter defaults

2011-05-31 Thread Simen Kjaeraas
On Tue, 31 May 2011 19:49:24 +0200, Steven Schveighoffer schvei...@yahoo.com wrote: Currently, you can omit the template args only in the case of IFTI (Implicit Function Template Instantiation) which actually deduces your template arguments based on the function call. I'd argue actually,

Template parameter defaults

2011-05-30 Thread Johann MacDonagh
I'm wondering if there's a cleaner way to do this: class Test(T = uint) { this(string s) { } } void main(string[] argv) { auto a = new Test!()(test); } I'd *like* to be able to do this: auto a = new Test(test); and: auto a = new Test!double(test); The only possibility I see

Re: Template parameter defaults

2011-05-30 Thread Jacob Carlborg
On 2011-05-30 15:42, Johann MacDonagh wrote: I'm wondering if there's a cleaner way to do this: class Test(T = uint) { this(string s) { } } void main(string[] argv) { auto a = new Test!()(test); } I'd *like* to be able to do this: auto a = new Test(test); and: auto a = new

Re: Template parameter defaults

2011-05-30 Thread Johann MacDonagh
On 5/30/2011 10:12 AM, Jacob Carlborg wrote: If you want to use the default parameter I think you have to do this: auto a = new Test!()(test); Yeah, that's the best I could come up with too :( I suppose users can alias it if necessary. Thanks!

Re: Template parameter defaults

2011-05-30 Thread Jonathan M Davis
On 2011-05-30 06:42, Johann MacDonagh wrote: I'm wondering if there's a cleaner way to do this: class Test(T = uint) { this(string s) { } } void main(string[] argv) { auto a = new Test!()(test); } I'd *like* to be able to do this: auto a = new Test(test);