Allocator-aware @safe reference counting is still not possible

Dukc ajieskola at gmail.com
Mon Jan 30 12:17:38 UTC 2023


On Monday, 30 January 2023 at 01:07:32 UTC, Timon Gehr wrote:
>> Working code:
>> https://github.com/ntrel/stuff/blob/master/typecons/isolated.d
>> 
>> Isolated could go in std.typecons.
>
> Isolated is not sufficient, you also have to guarantee the 
> pointer was allocated with `malloc`.

This could be accomplished with building a wrapper type over 
`malloc`ed pointers. `@safe` `free` would accept only them, not 
any isolated pointer.


More information about the Digitalmars-d mailing list