Why can't rvalues be passed to a 'ref' parameter?

zjh fqbqrr at 163.com
Mon Dec 12 01:34:16 UTC 2022


On Sunday, 11 December 2022 at 16:48:57 UTC, Ali Çehreli wrote:

> However, the situation has changed in D: It has been possible 
> to pass rvalues by reference through the magic of 'in' 
> parameters. This currently requires the -preview=in compiler 
> switch, which makes 'in' parameters imply 'const scope':
>
>   https://dlang.org/spec/function.html#in-params
>
> [...]

Thank you for your detailed `explanation`.




More information about the Digitalmars-d-learn mailing list