With GCC 4.8.0 released, we have a compiler that supports automatic return type deduction, part of C++14. With -std=c++1y
, I can do this:
auto
I want to provide an example where return type auto is perfect:
Imagine you want to create a short alias for a long subsequent function call. With auto you don't need to take care of the original return type (maybe it will change in future) and the user can click the original function to get the real return type:
inline auto CreateEntity() { return GetContext()->GetEntityManager()->CreateEntity(); }
PS: Depends on this question.