digitalmars.D - Variadic template alias parameters
- Dylan Knutson (10/10) Jun 04 2013 Hello!
- Simen Kjaeraas (6/15) Jun 04 2013 Try without the alias - variadic template parameters may be aliases or
- Dylan Knutson (4/7) Jun 04 2013 Oh; I didn't know that variadic template params were aliased.
- Timon Gehr (4/10) Jun 04 2013 Oh, it is more subtle than that. DMD won't accept built-in types as
- Timon Gehr (7/16) Jun 04 2013 It wouldn't add any functionality.
Hello! As far as I can tell, you can't have a variadic of alias parameters on a template, which is strange to me. Eg, you can't do something like: template Foo(alias Args...) { ... } int i = 0; Foo!(std.conv, "123", i); Is there a reason for this restriction?
Jun 04 2013
On 2013-06-05, 00:33, Dylan Knutson wrote:Hello! As far as I can tell, you can't have a variadic of alias parameters on a template, which is strange to me. Eg, you can't do something like: template Foo(alias Args...) { ... } int i = 0; Foo!(std.conv, "123", i); Is there a reason for this restriction?Try without the alias - variadic template parameters may be aliases or types or any mix thereof. Also, please ask such questions in digitalmars.D.learn in the future. -- Simen
Jun 04 2013
Also, please ask such questions in digitalmars.D.learn in the future.Sorry; I was trying to decide if if belonged there or here, so I decided on here because it was a question about D's grammar.It wouldn't add any functionality.Oh; I didn't know that variadic template params were aliased. Thanks for the clarification :-)
Jun 04 2013
On 06/05/2013 01:13 AM, Dylan Knutson wrote:Oh, it is more subtle than that. DMD won't accept built-in types as arguments to alias template parameters, but they still can be passed as arguments to variadic template params.Also, please ask such questions in digitalmars.D.learn in the future.Sorry; I was trying to decide if if belonged there or here, so I decided on here because it was a question about D's grammar.It wouldn't add any functionality.Oh; I didn't know that variadic template params were aliased. Thanks for the clarification :-)
Jun 04 2013
On 06/05/2013 12:33 AM, Dylan Knutson wrote:Hello! As far as I can tell, you can't have a variadic of alias parameters on a template, which is strange to me. Eg, you can't do something like: template Foo(alias Args...) { ... } int i = 0; Foo!(std.conv, "123", i); Is there a reason for this restriction?It wouldn't add any functionality. template Foo(Args...) { ... } int i = 0; Foo!(std.conv, "123", i);
Jun 04 2013