I often write stuff like:
const auto end = some_container.end(); for( auto it = some_container.begin(); it != end; ++it ) { const auto &item_container = *it; const auto end = item_container.end() for( auto it = item_container.begin(); it != end; ++it ) { do_awesome_stuff_with_the_iterator(); } } Except for the name of the second variable end and it, which up until now, I have given different names. Is it bad style/practice to "reuse" the same name for another variable in a sub-scope? I understand you won't be able to access the outer end and it variables, but that's not necessary. I don't think this is confusing (strange suffixed names are uglier in my eyes), but is there a concrete reason not to do this?