How to get to a class initializer through introspection?

Johan j at j.nl
Mon Aug 3 14:49:10 UTC 2020


On Monday, 3 August 2020 at 14:35:27 UTC, Adam D. Ruppe wrote:
>
> Regardless, yeah, the pragma(mangle) trick can probably help 
> you here too at least as a hacky solution. Let me know if you 
> figure out the incantation to make ldc accept it, or if I come 
> back to it I'll let you know the solution here too. But for dmd 
> it is easy.

For structs, `typeof(T.init)` works, but for classes I also have 
not figured out how to do it. Because a class variable is always 
a reference (pointer), you basically need something like 
`typeof(*Klass)`...

-Johan



More information about the Digitalmars-d mailing list