Is there a way to use Object.factory with templated classes? Or some way to construct templated classes given RTTI of an instance?

Adam D. Ruppe destructionator at
Thu Sep 27 13:16:58 UTC 2018

On Thursday, 27 September 2018 at 05:18:14 UTC, Chad Joan wrote:
> How does this work?
> The language reference states that typeid(Type) returns "an 
> instance of class TypeInfo corresponding to Type".
> (
> But then the TypeInfo class doesn't seem to have a .create() 
> method, or at least not one in the documentation:

I forgot about the create method, lol, that is what you want.

But typeid(obj) - pass it an existing object of the type btw - 
when obj is a class will return TypeInfo_Class - a subclass of 

It is *that* which has the create method.

(or less horrible docs

More information about the Digitalmars-d-learn mailing list