On Wed, Apr 15, 2009 at 1:35 AM, Christopher Wright <dhase...@gmail.com> wrote: > 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)? > > There is no way that I know of to do so, and I've looked into the issue > previously. -- I don't know how TypeInfo is instantiated; I imagine it's in > the data segment of the executable; so it should be possible to examine all > symbols in an executable to find TypeInfo instances and determine what they > refer to. However, the language and runtime lack support for this. >
Seems reasonable to me to add a TypeInfo field to ClassInfo.