Types as keys

Jakob Ovrum via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 26 08:02:24 PST 2016


On Tuesday, 26 January 2016 at 15:54:14 UTC, Voitech wrote:
> How to handle this correctly?

Make BaseParser the value type of the AA. Parser!Foo and 
Parser!Bar are subtypes of BaseParser.

Unlike Java, just `Parser` is not a type but a template. It must 
be instantiated to create a type. Java implements generics 
differently from templates, with its own set of disadvantages and 
advantages.



More information about the Digitalmars-d-learn mailing list