Challenge: write a reference counted slice that works as much as possible like a built-in slice
elronnd at elronnd.net
Wed Dec 15 09:53:41 UTC 2021
On Wednesday, 15 December 2021 at 08:27:25 UTC, RazvanN wrote:
> My perspective is that currently you have an easy way to bypass
> destruction but you need to do the union trick to bypass
> destruction. I would vote for having a dip that would somehow
> make it easy to express the intent that you want to avoid
> destruction for a specific object.
(In particular, I agree with the other folks you cite that
void-initialisation should not bypass destruction. To me,
void-initialisation is not a way of _bypassing_ construction, but
is an _optimization_ you can apply when the compiler tried to
construct some object more than once.
But I agree that it should be possible to bypass destruction.)
More information about the Digitalmars-d