Embedded Containers

A Guy With a Question aguywithanquestion at gmail.com
Tue Dec 5 19:13:10 UTC 2017


On Tuesday, 5 December 2017 at 19:09:50 UTC, Adam D. Ruppe wrote:
> 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.

Ok, so that worked. I still have the problem with importing 
though:

mypackage: Item

seems to generate the error:

"Error: undefined identifier 'Item'"

Which is weird, because I'm able to bring in Array through 
std.container.array: Array;


More information about the Digitalmars-d mailing list