What is the meaning of auto when using C++ trailing return type?

In general, the new keyword auto in C++11 indicates that the type of the expression (in this case the return type of a function) should be inferred from the result of the expression, in this case, what occurs after the ->.

Without it, the function would have no type (thus not being a function), and the compiler would end up confused.

Leave a Comment