std.experimental.allocator and const etc.

John Colvin john.loughran.colvin at gmail.com
Sun Jul 15 13:06:16 UTC 2018


Currently the API's don't support const(void)[], e.g.

import std.experimental.allocator : makeArray, theAllocator, 
dispose;
import std.experimental.allocator.mallocator : Mallocator;

void main()
{
     const a = theAllocator.makeArray!ubyte(100);
     theAllocator.dispose(a);
     // can't call RCIAllocator.deallocate(void[] b) with 
const(ubyte)[]

     const(void)[] b = Mallocator.instance.allocate(100);
     Mallocator.instance.deallocate(b);
     // can't call Mallocator.deallocate(void[] b) with 
const(void)[]
}

Is this deliberate? It's pretty annoying.


More information about the Digitalmars-d mailing list