How to get to a class initializer through introspection?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Aug 4 02:09:13 UTC 2020


On 8/3/20 10:47 AM, Adam D. Ruppe wrote:
> On Monday, 3 August 2020 at 14:44:38 UTC, Johan wrote:
>> If `__traits(type, getInitializer)` would return a function, then 
>> that's a different story...
> 
> Yes... and then it could skip =void items too. Like
> 
> struct A {
>    int a = 10;
>    ubyte[10000] b = void;
>    int c = 20;
> }
> 
> Could very well just be the two int assigns. Right now it will spit out 
> 10000 zeros in the middle.
Oh, yes forgot about that important efficiency matter. Yes it does look 
like we need a __trait after all.


More information about the Digitalmars-d mailing list