On Wednesday, 9 May 2018 at 13:22:56 UTC, bauss wrote:
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.
Its funny, because you example makes this look like a very bad feature. But there are legitimate cases which doesn't actually chance the api of the returned type.
