struct field initialization

bitwise via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 16 11:42:01 PDT 2017


On Wednesday, 16 August 2017 at 18:17:36 UTC, kinke wrote:
> On Wednesday, 16 August 2017 at 18:11:05 UTC, bitwise wrote:
>> If I define a non-default constructor for a struct, are the 
>> fields initialized to T.init by the time it's called?
>
> The struct instance is initialized with T.init before invoking 
> the constructor.

Thanks for the quick response.

In regards to my second question, the "value = T(args);" variant 
seems to work, even with a const T, without calling a postblit - 
so I guess that's what I'll use.


More information about the Digitalmars-d-learn mailing list