Allow auto in function parameters with default arguments?

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Sep 9 21:20:55 PDT 2012


It occurred to me that using a parameter with a default value that is
a function call could benefit from using auto:

struct Foo(T) { }

auto getFoo()
{
    return Foo!int();
}

void func(int x, auto foo = getFoo()) { }

Granted this is a simple case and might be overkill, but if the
function returns some complicated range type (or worse, a Voldemort
type) it might be hard or impossible to specify the type.


More information about the Digitalmars-d mailing list