Contextual metaprogramming, query the parent type.

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sat Feb 5 10:17:23 UTC 2022


On Friday, 4 February 2022 at 16:03:08 UTC, Nick Treleaven wrote:
> Sorry, that doesn't work. But hopefully you get the idea - the 
> string mixin produces something that obtains the parent type 
> name:
>
> ```d
> struct Parent
> {
>     pragma(msg, __traits(parent, {}).stringof); // Parent
> }
> ```

Thanks, now I have something to tinker with. :)



More information about the Digitalmars-d mailing list