On Saturday, 21 January 2017 at 02:47:49 UTC, bitwise wrote:
When std.experimental.allocator was created, I was under the impression it was meant to be used to make containers. But since allocate() returns void[], casts are required before using that memory, which is unsafe.

Is my only option to wrap the casts in an @trusted helper function? or am I missing something?

 Thanks

There's no need for casts. You can just use the high-level wrappers:
http://dlang.org/phobos-prerelease/std_experimental_allocator#.make

http://dlang.org/phobos-prerelease/std_experimental_allocator#.makeArray

http://dlang.org/phobos-prerelease/std_experimental_allocator#.dispose

http://dlang.org/phobos-prerelease/std_experimental_allocator#.makeMultidimensionalArray

http://dlang.org/phobos-prerelease/std_experimental_allocator#.disposeMultidimensionalArray

Reply via email to