Navigate from ClassInfo to TypeInfo
grauzone
none at example.net
Wed Apr 15 07:25:57 PDT 2009
Frank Benoit wrote:
> I need to retrieve an instance of TypeInfo from an object instance at
> runtime.
>
> TypeInfo info = typeid(obj) // does not work, only compile time
>
> TypeInfo info = obj.classinfo.????; // how to navigate to TypeInfo?
>
> Is that possible?
> If not, why? And can it be added (D1)?
I also did hit this issue. Fortunately, I never get a ClassInfo of a
class whose static type I didn't see at least once before. This means I
can get both the TypeInfo and ClassInfo from the static type, and put
them into a global AA like ClassInfo[TypeInfo].
More information about the Digitalmars-d
mailing list