Check whether string value represents a type

Basile B. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 24 00:08:56 PDT 2017


On Friday, 21 July 2017 at 14:21:37 UTC, Timoses wrote:
> I'd love to check whether a string value is the name of a type 
> at run-time.
> [...]
> The goal is to identify whether a string represents a custom 
> type within a package. I'm also trying to iterate over all 
> modules within the package to get the struct name. However, 
> that seems like a struggle...
>
> Any ideas?..

I used custom Runtime Type Infos for this:
https://github.com/BBasile/iz/blob/master/import/iz/rtti.d#L550
Each type for which that's interesting to have extra information 
is registered.
When a type is not registered than it can be considered as not a 
type.


More information about the Digitalmars-d-learn mailing list