`lvalueof` property on rvalues

Bastiaan Veelo Bastiaan at Veelo.net
Thu May 12 08:06:14 UTC 2022


On Monday, 9 May 2022 at 14:03:21 UTC, Basile B. wrote:
> [...] create a temporary variable if the exp it's used on is 
> not already a lvalue, otherwise it would do nothing.

That's what happens if you supply the `-preview=rvaluerefparam` 
compiler argument, right? Then this already works:

```d
void fun(ref int i) {}

void main()
{
     fun(1);
}
```

There is also `-preview=in`.

So what is the advantage of having to add `.lvalueof`?

-- Bastiaan.


More information about the Digitalmars-d mailing list