TypeInfo_Interface from runtime string?

Thalamus via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 22 08:54:32 PDT 2016


On Wednesday, 22 June 2016 at 15:46:15 UTC, Thalamus wrote:
> On Wednesday, 22 June 2016 at 15:43:08 UTC, Basile B. wrote:
>> On Wednesday, 22 June 2016 at 15:15:51 UTC, Thalamus wrote:
>>> [...]
>>
>> No need for a constructor. typeid() returns a static instance 
>> that's pre-allocated.
>>
>> [...]
>
> Thanks Basile.

Hit Send too soon...

Thanks Basile. As it turned out I was already doing something 
very similar for mapping types to interfaces and to other types, 
using shared static constructors to perform registration into 
associative arrays, e.g.

TypeInfo_Class[TypeInfo_Class]
      and
TypeInfo_Interface[TypeInfo_Class]

So I can easily add

TypeInfo_Interface[string]
      and
TypeInfo_Class[string]

as part of the existing registration process and then expose a 
simple lookup method. Thanks for the good idea! :)





More information about the Digitalmars-d-learn mailing list