Extend the call site default argument expansion mechanism?

Yuxuan Shui yshuiv7 at gmail.com
Fri May 11 21:43:05 UTC 2018


On Thursday, 10 May 2018 at 15:15:03 UTC, Paul Backus wrote:
> On Thursday, 10 May 2018 at 14:37:00 UTC, rikki cattermole 
> wrote:
>> On 11/05/2018 2:33 AM, Yuxuan Shui wrote:
>>> On Thursday, 10 May 2018 at 14:28:39 UTC, JN wrote:
>>> 
>>> But doing it with default argument expansion saves you 1 
>>> allocation, has 1 less type, while being just as readable. I 
>>> think that's a win.
>>
>> class -> struct, now it is back to 1 allocation.
>
> Even easier:
>
> alias createDataStructure = (...) => new DataStructure(..., 
> alloc);

I think one problem with this and Factory, is that you have to 
create one alias/lambda/factory type for every type that takes an 
allocator.


More information about the Digitalmars-d mailing list