equivalent of typeid(Class).name at compile-time

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Fri Nov 22 14:08:10 UTC 2019


On Thursday, 21 November 2019 at 20:48:03 UTC, Adam D. Ruppe 
wrote:
> On Thursday, 21 November 2019 at 20:45:16 UTC, Steven 
> Schveighoffer wrote:
>> To clarify, I need the compile time string that will match 
>> typeid(instance).name, so I can match the derived type.
>
> You have to make sure that the derived type is passed to your 
> register function, but then std.traits.fullyQualifiedName!T 
> ought to give it to you.

Please note that fullyQualifiedName can return slightly different 
string than ClassInfo.name for templated types (typeinfo returns 
names that are fully expanded for eponymous templates while FQN 
function does not) and hence won't recommend mixing both of them 
toghether.

Best regards,
Alexandru.


More information about the Digitalmars-d-learn mailing list