Say I have a std::vector of Entity's. I want to invoke the doUpdate-method on all of them. I would then write:
for( size_t i = 0; i < m_entities.size(); i++ )
m_entities.doUpdate();
However, I often see iterators used, which would give:
for( std::vector<Entity>::iterator i = m_entities.begin();
i != m_entities.end(); ++i )
(*i).doUpdate();
The question: I find the first solution more readable and easier to type. However, what are the reasons to use the second method? Coherency with lists (where you can't use []), speed, l33tness??