Use class template as a type
dm via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Nov 28 05:56:50 PST 2016
On Monday, 28 November 2016 at 11:30:23 UTC, rikki cattermole
wrote:
> In your case I'd just swap out ``MyClass[] someArray;`` to
> ``Object[] someArray;``.
> But only because there are no members added without the extra
> typing in MyClass.
>
> Remember types in meta-programming in D are not erased, they
> exist in the assembly and are unique. Unlike Java who did the
> implementation rather wrong.
I'm tried to use Object[], but got error
Error: no property 'value' for type 'object.Object'
I guess I must cast() to MyClassInt or MyClassFloat, but how can
I do it?
More information about the Digitalmars-d-learn
mailing list