What do you think of the auto keyword in C++? I've personally never found typing out the types to be a problem.
What do you think of the auto keyword in C++? I've personally never found typing out the types to be a problem.
But I don't think, that "auto" was specified to reduce typing. I see it more as a possibility to follow the "DRY" principle (don't repeat yourself).
There might be cases, where for example the return types of functions might change and you don't want to change every caller.
Templates are of course an other example, because the return types of templates oftentimes are depending of the input types. You of course can use those template declaration stuff, but it is very ugly and oftentimes clumsy.
I also found a nice example, where it really can help to make things more easy to read, here:
http://stackoverflow.com/questions/252671/auto-c-c/12573433#...
I think, the real usages are rare, that is also the reason, it was specified rather late.