News for hackers. Stuff that matters.
Re:What’s New in C# 7.0 by int_19h on Thursday August 25, 2016 @08:45PM (#12363561)
It was added in C++11 when they added decltype(), so that you could reference arguments when computing return type. It's slightly different though, in that you need to specify the return type in the usual position as "auto" first, and then you can use "->" after the parameter list. So:

  template<typename A1, typename A2>
  auto foo(A1 a1, A2 a2) -> decltype(a1 + a2) {
    return a1 + a2;
  }

There are no comments on this comment yet.