News for hackers. Stuff that matters.
Re:Current Proposals for C++17 by vmorgulis on Thursday February 25, 2016 @12:46PM (#11176141)
With Concepts, we will also have "auto" in function arguments. It avoids "template <typename ...>" for simple functions.

I already use it as a "catch all" over specialized functions (gcc -std=c++17).

Re:Current Proposals for C++17 by repsilat on Thursday February 25, 2016 @05:51PM (#11178486)
Why prefer

    int foo(auto a, auto &&b);
to

    int foo(a, &&b);
? Too big a change? Too much magic? Maybe more difficult to read or parse. The argument "It's not clear that the function is a template" isn't there any more, though, so it seems reasonable to me.
Re:Current Proposals for C++17 by kevinnk on Thursday February 25, 2016 @08:06PM (#11179189)
You actually hit on the exact reason; your change is significantly harder to parse. C++ allows you to alias typenames and variable names, so you wouldn't know if `int foo(T);` was a declaration of a function that take a type `T` or a function that has an implicitly typed parameter called `T` until much later in the parse. Adding auto makes it clear this is a declaration of a variable. That kind of ambiguity already exists in C++[1], but is widely regarded as one of the things that makes parsing C++ extremely hairy.

Interestingly, I remember hearing about this exact problem in the context of Swift's closures; if you want type inference, you need to leave off the parens around the parameters. This is mainly done (IIRC) because it's easier for the parser.

[1] http://blog.reverberate.org/2013/08/parsing-c-is-literally-u...

Re:Current Proposals for C++17 by vmorgulis on Friday February 26, 2016 @05:50AM (#11180791)
Do you mean?

    template <typename T1,typename T2>
    int foo(T1 a, T2 &&b);
"auto" is shorter.