How to manage function's parameter storage class?

Simen Kjærås simen.kjaras at gmail.com
Sat Jan 20 17:05:40 UTC 2018


On Saturday, 20 January 2018 at 14:31:59 UTC, Sobaya wrote:
> How can I wrap function whose arguments contain both ref and 
> normal like 'func' ?
> With normal 'Args', x is not increased because x is copied when 
> passed to opDispatch.
> If I write 'ref Args' in opDispatch's argument, it fails 
> because second parameter is not rvalue.

https://dlang.org/spec/function.html#auto-ref-functions

Simply put, instead of 'ref' use 'auto ref'.

--
   Simen


More information about the Digitalmars-d-learn mailing list