T.init, struct destructors and invariants - should they be called?

FeepingCreature feepingcreature at gmail.com
Fri Jul 6 10:45:39 UTC 2018


On Friday, 6 July 2018 at 10:44:09 UTC, FeepingCreature wrote:
> Consider the humble struct S
> {
>     Object obj;
>     invariant
>     {
>         assert(this.obj !is null);
>     }
>     @disable this();
>     this(Object obj)
>     in(obj !is null)
>     {
>         this.obj = obj;
>     }
> }

Oops - there should of course be a ~this() { } in there.


More information about the Digitalmars-d mailing list