Why was the addition of trailing-return-types necessary in C++11?
问题 I've finally started to read up on c++11 and I fail to understand why trailing-return-types are required. I came across the following example, which is used to highlight the problem: template<class Lhs, class Rhs> decltype(lhs+rhs) adding_func(const Lhs &lhs, const Rhs &rhs) {return lhs + rhs;} The example is illegal, because decltype(lhs+rhs) does not work, since the identifiers lhs and rhs are only valid after the parsing phase. I guess my question is about the timing of decltype type