Embedded interfaces with generic members

Ali Çehreli acehreli at yahoo.com
Tue Dec 5 19:27:37 UTC 2017


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



More information about the Digitalmars-d-learn mailing list