The use of auto to deduce the type of a variable from its initializer is obviously most useful when that type is either hard to know exactly or hard to write. ... When the type of a variable depends critically on template argument it can be really hard to write code without auto. For example:
The type of tmp should be what you get from multiplying a T by a U, but exactly what that is can be hard for the human reader to figure out, but of course the compiler knows once it has figured out what particular T and U it is dealing with. _ Stroustrup http://www.stroustrup.com/C++11FAQ.html#auto |
... it’s more than just a convenience when a type has an unknown or unutterable name, such as the type of most lambda functions, that you couldn’t otherwise spell easily or at all.
Sutter http://herbsutter.com/elements-of-modern-c-style/ |