On Sunday, 1 April 2018 at 15:54:16 UTC, Steven Schveighoffer wrote:
But I'd rather avoid such things if possible. Is there a way around this? Seems rather limiting that I can do:

Is this what you're looking for?

void foo(Nullable!int x = Nullable!int.init)
{   if (!x.isNull) x.get.writeln;
    else writeln;
}

void foo(int x)
{   return Nullable!int(x).foo;
}


void main()
{
   foo(1); // 1
   int x;
   foo(x++); // 0
   foo; // empty line
   foo(x); // 1
   readln();
}

Reply via email to