On Wednesday, 29 March 2017 at 23:26:04 UTC, H. S. Teoh wrote:
On Wed, Mar 29, 2017 at 11:01:12PM +0000, Enigma via Digitalmars-d-learn wrote:
On Wednesday, 29 March 2017 at 21:36:14 UTC, Petar Kirov [ZombineDev] wrote:
> [...]

But these seem to require passing a mallocator. I simply want to pass an already allocated region/block/buffer and have the allocators use it. I will allocate and free on my own.

Huh?  Where does it say that a mallocator is required?

As far as I can tell, you could simply do this:

        void[] myBuffer = ...;
        auto allocator = Region!()(myBuffer);
        auto p = allocator.allocate(...);

The default parent allocator is NullAllocator, which does nothing, so that leaves the management of myBuffer entirely up to you.


T

Thanks. All the examples show using a size rather than an array so I assumed that was the case.

Reply via email to