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 ?

Reply via email to