Example (I have to print in a separate function to avoid constant folding):
void foo(const int *x1, const int *x2)
{
import std.stdio: writeln;
writeln(*x1, " ", *x2);
}
void main()
{
import std.stdio: writeln;
int x1;
const int x2;
import std.algorithm: max, min;
auto v = max(&x1, &x2);
auto v2 = min(&x1, &x2);
*v = 5;
*v2 = 5;
foo(&x1, &x2);
}
compiles, prints 5 5, showing x2 has been changed.
Comment #1 by n8sh.secondary — 2021-02-17T06:09:34Z