Windows bindings
Elronnd
elronnd at elronnd.net
Tue Feb 16 21:48:12 UTC 2021
On Tuesday, 16 February 2021 at 21:35:32 UTC, Elronnd wrote:
> On Saturday, 13 February 2021 at 00:32:30 UTC, Rumbu wrote:
>> 4) On RAIFree attribute
> struct RaiiFreer(T, alias f) ...
On Saturday, 13 February 2021 at 16:01:26 UTC, Steven
Schveighoffer wrote:
> Don't do this, because it will close on copying too.
>
> In order to *properly* implement this, it would need reference
> counting.
It's easy to get double frees with that solution--right. Can
disable copy constructor, or make it a class. I would go for the
former, as it's more flexible: if you need ref semantics, just
make a pointer or use phobos refcount.
I disagree that you _need_ refcounting to get it right, though.
Providing a destructor makes it a more native interface.
Manually destroying is something you would have had to do anyway,
but now you can destroy the object the same as you would any
other.
More information about the Digitalmars-d
mailing list