@safe containers with std.experimental.allocator

bitwise via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 24 11:38:31 PST 2017


On Sunday, 22 January 2017 at 13:21:41 UTC, Andrei Alexandrescu 
wrote:
> On 1/21/17 10:07 PM, bitwise wrote:
>> On Saturday, 21 January 2017 at 23:24:52 UTC, Andrei 
>> Alexandrescu wrote:
>>> Andrei
>>
>> Anyways, design opinions aside, I would be satisfied if an 
>> aligned
>> allocator were included in std.allocators that provided 
>> aligned heap
>> memory using allocate()/deallocate(). The rest is just details 
>> with no
>> practical relevance for my immediate plans.
>>
>>   Thanks
>
> That should be easy and useful as an adapter over another 
> allocator that supports alignedAllocate(). Please create an 
> issue for that. Thanks! -- Andrei

I would, but I'm not sure I can use these allocators.

Ran into this:
http://forum.dlang.org/post/akohcwiotlcrodemhexx@forum.dlang.org

As stated in that thread, I can mark the member instance of the 
allocator in the container as 'shared', but then, if I use an 
allocator _without_ 'shared' methods, I get errors as well.

I'm not sure if there is a solution for this, but at this point, 
I try to just avoid 'shared' at all costs. The fact that 
Mallocator is thread safe should not stop me from using it in a 
non-thread safe class, but it does.


More information about the Digitalmars-d mailing list