Vote on region allocator

Peter Alexander peter.alexander.au at gmail.com
Mon Sep 26 11:21:15 PDT 2011


On 26/09/11 5:10 AM, dsimcha wrote:
> On 9/25/2011 6:24 PM, Peter Alexander wrote:
>> On 25/09/11 10:57 PM, dsimcha wrote:
>>> On 9/25/2011 4:40 PM, Peter Alexander wrote:
>>>> On 25/09/11 1:20 AM, dsimcha wrote:
>>>>> On 9/24/2011 7:55 PM, Andrei Alexandrescu wrote:
>>>>>> Defining and using an allocator interface would have a small speed
>>>>>> impact (i.e. allocation would entail an indirect call) but I think
>>>>>> that
>>>>>> would be acceptable.
>>>>>
>>>>> Agreed. My much bigger concern w.r.t. dynamic interfaces is their
>>>>> inflexibility, i.e. that they can't be used effectively with template
>>>>> metaprogramming.
>>>>
>>>> In what way would you want to meta-program with allocators?
>>>
>>> Allocating arrays, etc.
>>
>> I'm not following. Can you give an example of something that wouldn't
>> work if we had dynamic interfaces instead of templated ones?
>
> T newArray(T, I...)(I sizes);
>
> // Usage:
> auto foo = newArray!(uint[])(5);
>
> This would be marginally do-able but very ugly if RTTI were used.

Ok, now I'm really lost. Where do allocators come into that?


More information about the Digitalmars-d mailing list