The newer versions of C++ have introduced an auto keyword, which basically automatically sets the data type of variable. I can imagine it being useful in situations like these, where it increases coding speed and prevents unnecessary cluttering.
vector< pair <int, int> > foo;
for(auto i=foo.begin(),i!=foo.end(),++i)
{
.....
}
However still it just seems as a small advantage. Also using it in place of int , string, etc just causes a lot of confusion, like dealing with variables in any weakly typed language, say Javascript.
var foo=13.67;
foo="it's a string"
Though using auto prevents assigning a string as an int, but using it everywhere makes debugging a nightmare
Say you shouldnt be doing this in C++
auto x="mewat1000";
auto y=5.33;
So what other useful feature it serves, which I seem to be missing out ?
Upd1 : One of my few posts which didnt get downvoted to oblivion. Rest of the posts disapper from recent blog activity list within 15-20 mins of posting them.









You can feel all power of keyword auto when you use it with range-based loops. Your code can be modified this way.
In fact this is not only the power of
auto. This is for loop based on range and equivalent toautojust makes the code shorter.I what do you mean by increasing speed?