On Wed, 28 Mar 2012, Gabriel Dos Reis wrote:
On Wed, Mar 28, 2012 at 10:51 AM, Marc Glisse <marc.gli...@inria.fr> wrote:
On Sun, 25 Mar 2012, Marc Glisse wrote:
- a first goal is simple functions, with a single return statement (which
may even often be the only statement).
After playing with it a bit, I am not sure how to use it in the simple
forwarding case:
T f(int);
auto g(int i){return f(i);}
function call or return value is equivalent to initialization. So, the
deduction works (as it should) as if you wrote
auto x = f(i);
I agree that it works like initialization, and like lambdas, so that ship
has sailed. I assume there were good reasons for that, even if they are
not obvious, I know things can be trickier than they appear. However, I
can't help thinking that there is something wrong with having to write:
auto g(int i) -> decltype(f(i)) { return f(i); }
(and even worse with noexcept(noexcept(f(i))), but that's another issue)
for a simple macro-like forwarding function.
Now fixing that isn't the goal of Jason's proposal and this is fine.
--
Marc Glisse