hasElaborateDestructor
Paul Backus
snarwin at gmail.com
Mon Apr 28 01:24:44 UTC 2025
On Sunday, 27 April 2025 at 21:43:26 UTC, claptrap wrote:
> What the heck does elaborate mean in this context? I mean a
> type has a destructor or not right? Why is a struct destructor
> called "elaborate" and a class destructor not?
>
> Or is this just another case of programmers cant think up
> sensible names for stuff?
`hasElaborateDestruction!T` is `true` if and only if (a) `T` has
a destructor, and (b) a local variable of type `T` will have that
destructor called on it at the end of its scope. It returns
`false` for classes because classes are reference types, and the
destructor on a class *instance* is not called when the
*reference* goes out of scope.
A more accurate name would be `hasElaborateDestruction`.
More information about the Digitalmars-d
mailing list