Can you fix this code to avoid using pointers?
XavierAP via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Mar 11 12:07:39 PST 2017
On Saturday, 11 March 2017 at 19:15:59 UTC, H. S. Teoh wrote:
>
> What about just:
>
> foreach (const ref p; [in1, in2, in3, in4])
I would think there will be already one copy from the local
parameter variables to the in situ array. Then from that one into
the for each element it's ref'd all right. But I'm afk and can't
test.
Like the other copy I missed and Adam spotted when passing the
arguments with missing ref qualifiers..
I realized that the code that sparked the question made no sense
and should be done in a different way... As is always the case
when these questions come up.
But I still like the version with pointers ;)
More information about the Digitalmars-d-learn
mailing list