Returning value by ref does not create a ref. Is this intentional?
Tejas
notrealemail at gmail.com
Wed Jan 5 11:10:09 UTC 2022
On Wednesday, 5 January 2022 at 08:58:44 UTC, Dennis wrote:
> On Wednesday, 5 January 2022 at 05:38:45 UTC, Tejas wrote:
>> The entire reason I wanted to get a `ref` was so that I can
>> avoid the `*` :(
>
> I don't know what the real code behind the reduced example is,
> but maybe you can structure your code such that the subsequent
> modification `c = 10` happens in its own function. Then you can
> pass the result of `func(a)` to that function by `ref`.
There isn't any complex code behind this.
I was simply trying to emulate C++'s `int&`(or `T&` in general)
More information about the Digitalmars-d-learn
mailing list