Thread overview
Variadic template alias parameters
Jun 04, 2013
Dylan Knutson
Jun 04, 2013
Simen Kjaeraas
Jun 04, 2013
Dylan Knutson
Jun 04, 2013
Timon Gehr
Jun 04, 2013
Timon Gehr
June 04, 2013
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?
June 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
June 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);
June 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 :-)
June 04, 2013
On 06/05/2013 01:13 AM, Dylan Knutson wrote:
>> 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 :-)

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.