Embedded Containers

Adam D. Ruppe destructionator at gmail.com
Tue Dec 5 19:09:50 UTC 2017


On Tuesday, 5 December 2017 at 19:01:48 UTC, A Guy With a 
Question wrote:
> alias Items(T) = Array!Item(T);

try:

Array!(Item!(T))

> I'm not quite sure I understand how to create a generic 
> container interface or class in D.

Just using the parenthesis should help. The thing with A!B!C is 
that the reader can easily be confused: did you mean A!(B!C) or 
(A!B)!C or what? Now the compiler is a bit stupider about this 
than it should be IMO - it should be able to figure it out and 
the meaning be fairly clear with association - but it isn't, so 
you can and must write parens to clarify most the time.


More information about the Digitalmars-d mailing list