std.allocator ready for some abuse

Namespace rswhite4 at googlemail.com
Fri Oct 25 00:57:30 PDT 2013


On Friday, 25 October 2013 at 07:50:00 UTC, Marco Leise wrote:
> Am Fri, 25 Oct 2013 00:33:40 +0200
> schrieb "Namespace" <rswhite4 at googlemail.com>:
>
>> Another idea would be that every built-in array has a 
>> Allocator property which can be set:
>> ----
>> int[] arr;
>> arr.allocator = Mallocator;
>> ----
>
> The type of arr.allocator would have to be CAllocator to allow
> runtime swapping of allocators with polymorphism.
>
> Would you'd implement it like .capacity, as a virtual property
> that doesn't take up space in the slice?

Yes I would, but it's not up to me. But I would prefer this 
solution because it is more flexible IMO.


More information about the Digitalmars-d mailing list