On Saturday, 13 February 2016 at 21:12:10 UTC, Andrei Alexandrescu wrote:
On 02/13/2016 03:07 PM, Iakh wrote:
So you can use metadata only with global allocators,
until you don't need to save ref to the allocator.

Well you can use other allocators if you save them so you have them available for deallocation. -- Andrei

Yeap. You did catch me. And if you don't have "@intransitive const" or
C++'s mutable you can't save ref to the allocator within object:

struct RCExternal
{
    //alias allocator = theGlobalAllocator;
auto allocator = &theGlobalAllocator; // assign mutable to immutable

    private void[] data;

    ~this () { allocator.decRef(data.ptr); }
}

Reply via email to