Auto ref function : How is this possible ?
matovitch via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Apr 11 03:08:38 PDT 2015
Hi,
I just learn about auto ref functions and tried this :
import std.stdio;
auto ref foo(int i, ref float f)
{
if (i < f)
{
return i;
}
else
{
return f;
}
}
void main()
{
int i = 1;
float f1 = 1.1;
float f2 = 0.9;
writeln(foo(i, f1));
writeln(foo(i, f2));
}
Tricky questions : Does it compiles ? If yes what does it do ?
Then my question : How is this possible ?
More information about the Digitalmars-d-learn
mailing list