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

zjh fqbqrr at 163.com
Sun Dec 11 09:25:06 UTC 2022


On Sunday, 11 December 2022 at 04:36:45 UTC, thebluepandabear 
wrote:

> "The main reason for this limitation is the fact that a 
> function taking a ref
> parameter can hold on to that reference for later use, at a 
> time when the rvalue
> would not be available."
>


I only know that `rvalue` is a temporary value that will not be 
used, while `ref` is omitting a pointer.



More information about the Digitalmars-d-learn mailing list