On Wednesday, 9 May 2018 at 12:44:34 UTC, Jonathan M Davis wrote:
On Monday, April 30, 2018 21:11:07 Gerald via Digitalmars-d wrote:
[...]

I think that the overall consensus is that it's great but that you do have to be careful about using it when it reduces clarity without adding other benefits.

[...]

Using "auto" you can also have multiple return types.

auto foo(T)(T value)
{
    static if (is(T == int)) return "int: " ~ to!string(value);
    else return value;
}

You cannot give that function a specific return type as it's either T or it's string. It's not a single type.

Reply via email to