Mallocator

Erik Smith via Digitalmars-d digitalmars-d at puremagic.com
Thu Mar 3 12:59:12 PST 2016


On Thursday, 3 March 2016 at 20:31:47 UTC, Meta wrote:
> On Thursday, 3 March 2016 at 20:16:55 UTC, Erik Smith wrote:
>>
>> The later works and qualifying the allocator member variable 
>> shared seems to solve the issue.  Example:
>>
>> struct A(T) {
>>     alias Allocator = T;
>>     shared Allocator allocator;
>>     this(string url="") {
>>         allocator = Allocator();
>>         void *p1 = cast(void*)(allocator.allocate(1024));
>>         //void p2[] = allocator.allocate(1024); // ICE
>>     }
>> }
>
> Does this still ICE when you write it as `void[] p2 = 
> allocator.allocate(1024)`?

No.  :)



More information about the Digitalmars-d mailing list