copy-ctor's
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Sun May 26 23:53:35 UTC 2019
On Sunday, 26 May 2019 at 23:45:05 UTC, Ola Fosheim Grøstad wrote:
> On Sunday, 26 May 2019 at 22:33:48 UTC, Manu wrote:
>> Oh, no.. that's search results, listed recent first. I didn't
>> realise the forum could do that.
>
> Oh yes, that can be confusing.
>
> Untagged unions doesn't really play well with destructors in
> any language. I think C++ requires that those destructors are
> ignored and that the union's destructor should do the cleanup.
> Seems like a thing that is easy to forget though…
I vaguely remember Bearophile suggest that the union/struct
should provide a means to identify which type the union was
holding.
One usually has a union in a struct that also contains a tag of
some sort that signifies the type of the union… but I think this
is outside the scope of D as a language.
So perhaps one should not be allowed to have destructors in
untagged unions and encourage the use of tagged unions…
More information about the Digitalmars-d
mailing list