let (x,y) = ...

thedeemon via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon Nov 23 06:54:12 PST 2015


On Monday, 23 November 2015 at 11:12:33 UTC, visitor wrote:

>> My original solution remembers in the constructor addresses of 
>> variables to fill, then does the filling in opAssign operator, 
>> so I needed a way to store the references and used pointers 
>> for that.
>
> yes, but you are using ref : "auto let(Ts...)(ref Ts vars)"
> so vars are changed, no need to store anything, no?
> i was wondering if there is some subtleties or efficiency 
> reasons for using pointers

Thanks for the code!
Yep, this way it works too, by capturing input vars in a closure. 
So the main difference is that your variant allocates GC memory 
while original variant does not allocate anything in the heap 
(only on stack).


More information about the Digitalmars-d-announce mailing list