Have a template function register(T)() instantiated and executed at startup for all sub classes of a specific base class?

monkyyy crazymonkyyy at gmail.com
Sun Sep 21 20:19:14 UTC 2025


On Sunday, 21 September 2025 at 10:15:54 UTC, Arafel wrote:
> I would like to have a custom root object that automagically 
> offers runtime introspection

https://gist.github.com/crazymonkyyy/14e36a99dd307c5d6e37bdb3ca2524a7

Consider this direction, where you implement your introspection 
compile time but your `sumtype` abstraction carrys the result 
forward at runtime.

If you grab a compile time counter(I know of two, one is ub but 
its the only sensable behavoir, the other is O(n) and getting a 
leak of order of operations of mixins) typeinfo could be 
minimized to a small int + your flags; been looking into this.


More information about the Digitalmars-d mailing list