for(auto it = M.begin(); it!=M.end();it++)
{
cout<<it->first<<" "<<it->second<<"\n";
}
The above code works absolutely fine But,
for(auto it : M)
{
if(it->second == 1) return it->first;
}
This gives me an error.
Why do I have to use it.second and it.first instead of it->second and it->first?