out parameter with default value

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 29 09:20:42 PDT 2014


On Monday, 29 September 2014 at 16:09:11 UTC, AsmMan wrote:
> My question is why it doesn't works and if there's a workaround

For the same reason `ref` wouldn't work in this place: It doesn't 
accept rvalues.

A workaround might be to create a global variable that is 
initialized to the value you want, and use this as the default 
value. But this probably isn't what you look for, because you're 
most likely going to overwrite it, so the next time the function 
gets called, it will have a different value.


More information about the Digitalmars-d-learn mailing list