3 ms·
Iterators can get very ugly. I like this when there is a need to access elem a lot inside the loop: for (size_t i = 0, iEnd = elems.size(); i < iEnd; ++i)
by mrich 13y ago
Iterators can get very ugly. I like this when there is a need to access elem a lot inside the loop:
for (size_t i = 0, iEnd = elems.size(); i < iEnd; ++i)
{
Elem &elem = elems[i];
// deal with elem
}
Of course the new C++11 syntax is king.