Details on how aggregates are constructed with `new` and later destroyed by the GC

Stanislav Blinov stanislav.blinov at gmail.com
Mon Oct 8 12:25:51 UTC 2018


On Monday, 8 October 2018 at 11:19:40 UTC, Per Nordlöw wrote:
> And how this is related to the trait `hasElaborateConstructor` 
> for both `classes` and `structs`.

There's no such trait as far as I'm aware. If there were, it'd 
likely be checking for the presence of a '__ctor' member. Thing 
is, it can't be generic because ctors may be templates, the best 
that can be done is checking if `T` is constructible with some 
arguments `Args`.

>  And how this is related to the trait `hasElaborateDestructor` 
> for both `classes` and `structs`.

It isn't. The trait literally just checks if the compiler has 
generated a '__dtor' member, and it doesn't do so for classes at 
all.


More information about the Digitalmars-d-learn mailing list