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".
(https://dlang.org/spec/expression.html#typeid_expressions)
But then the TypeInfo class doesn't seem to have a .create()
method, or at least not one in the documentation:
https://dlang.org/phobos/object.html#.TypeInfo
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
TypeInfo.
It is *that* which has the create method.
https://dlang.org/phobos/object.html#.TypeInfo_Class.create
(or less horrible docs
http://dpldocs.info/experimental-docs/object.TypeInfo_Class.html
)