Re: Embedded interfaces with generic members

2017-12-05 Thread A Guy With a Question via Digitalmars-d-learn

On Tuesday, 5 December 2017 at 19:27:37 UTC, Ali Çehreli wrote:

On 12/05/2017 11:07 AM, A Guy With a Question wrote:
> The following doesn't appear to be valid syntax. Array!Item!T

You can ommit the template argument list parenteses only for 
single symbols.


Starting with the full syntax:

  Array!(Item!(T))

Since Item!(T) uses a single symbol, T, you can remove the 
parenteses from that one:


  Array!(Item!T)

The following compiles:

import std.container.array;

struct Item(T) {
}

void main() {
alias T = int;
auto a = Array!(Item!T)();
}

Ali


yup that was the issue.


Re: Embedded interfaces with generic members

2017-12-05 Thread Ali Çehreli via Digitalmars-d-learn

On 12/05/2017 11:07 AM, A Guy With a Question wrote:
> The following doesn't appear to be valid syntax. Array!Item!T

You can ommit the template argument list parenteses only for single symbols.

Starting with the full syntax:

  Array!(Item!(T))

Since Item!(T) uses a single symbol, T, you can remove the parenteses 
from that one:


  Array!(Item!T)

The following compiles:

import std.container.array;

struct Item(T) {
}

void main() {
alias T = int;
auto a = Array!(Item!T)();
}

Ali